File tree Expand file tree Collapse file tree 1 file changed +3
-3
lines changed
source/reference/operator Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change 18
18
db.inventory.find( { qty: { $mod: [ 4, 0 ] } } )
19
19
20
20
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
22
22
documents with ``qty`` value equal to ``0`` or ``12``.
23
23
24
24
In some cases, you can query using the :operator:`$mod` operator
27
27
28
28
.. code-block:: javascript
29
29
30
- db.inventory.find( { qty: { $mod: [ 4, 3 ] } } )
30
+ db.inventory.find( { qty: { $mod: [ 4, 0 ] } } )
31
31
32
32
The above query is less expensive than the following query which
33
33
uses the :operator:`$where` operator:
34
34
35
35
.. code-block:: javascript
36
36
37
- db.inventory.find( { $where: "this.qty % 4 == 3 " } )
37
+ db.inventory.find( { $where: "this.qty % 4 == 0 " } )
38
38
39
39
.. seealso::
40
40
You can’t perform that action at this time.
0 commit comments