From b3d6df738838b567392dd6dfa4a4a741065962f9 Mon Sep 17 00:00:00 2001 From: jarhall Date: Mon, 10 Dec 2012 10:56:11 -0500 Subject: [PATCH] Update source/reference/operator/mod.txt Fixed modulo math error. Made all modulo expressions consistent: x % 4 = 0 --- source/reference/operator/mod.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/source/reference/operator/mod.txt b/source/reference/operator/mod.txt index 55a51273be1..bfbc5e5d646 100644 --- a/source/reference/operator/mod.txt +++ b/source/reference/operator/mod.txt @@ -18,7 +18,7 @@ $mod db.inventory.find( { qty: { $mod: [ 4, 0 ] } } ) This query will select all documents in the ``inventory`` collection - where the ``qty`` field value modulo ``4`` equals ``3``, such as + where the ``qty`` field value modulo ``4`` equals ``0``, such as documents with ``qty`` value equal to ``0`` or ``12``. In some cases, you can query using the :operator:`$mod` operator @@ -27,14 +27,14 @@ $mod .. code-block:: javascript - db.inventory.find( { qty: { $mod: [ 4, 3 ] } } ) + db.inventory.find( { qty: { $mod: [ 4, 0 ] } } ) The above query is less expensive than the following query which uses the :operator:`$where` operator: .. code-block:: javascript - db.inventory.find( { $where: "this.qty % 4 == 3" } ) + db.inventory.find( { $where: "this.qty % 4 == 0" } ) .. seealso::