Skip to content

Commit b3d6df7

Browse files
committed
Update source/reference/operator/mod.txt
Fixed modulo math error. Made all modulo expressions consistent: x % 4 = 0
1 parent 8d05167 commit b3d6df7

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

source/reference/operator/mod.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ $mod
1818
db.inventory.find( { qty: { $mod: [ 4, 0 ] } } )
1919

2020
This query will select all documents in the ``inventory`` collection
21-
where the ``qty`` field value modulo ``4`` equals ``3``, such as
21+
where the ``qty`` field value modulo ``4`` equals ``0``, such as
2222
documents with ``qty`` value equal to ``0`` or ``12``.
2323

2424
In some cases, you can query using the :operator:`$mod` operator
@@ -27,14 +27,14 @@ $mod
2727

2828
.. code-block:: javascript
2929

30-
db.inventory.find( { qty: { $mod: [ 4, 3 ] } } )
30+
db.inventory.find( { qty: { $mod: [ 4, 0 ] } } )
3131

3232
The above query is less expensive than the following query which
3333
uses the :operator:`$where` operator:
3434

3535
.. code-block:: javascript
3636

37-
db.inventory.find( { $where: "this.qty % 4 == 3" } )
37+
db.inventory.find( { $where: "this.qty % 4 == 0" } )
3838

3939
.. seealso::
4040

0 commit comments

Comments
 (0)