File tree Expand file tree Collapse file tree 1 file changed +8
-4
lines changed
source/reference/operator Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Original file line number Diff line number Diff line change 1010
1111 *Syntax*: ``{ $and: [ { <expression1> }, { <expression2> } , ... , { <expressionN> } ] }``
1212
13- :operator:`$and` performs a logical ``AND`` operation on an array
14- of *two or more* expressions (e.g. ``<expression1>``,
13+ :operator:`$and` performs a logical ``AND`` operation on an array of
14+ *two or more* expressions (e.g. ``<expression1>``,
1515 ``<expression2>``, etc.) and selects the documents that satisfy
16- *all* the expressions in the array.
16+ *all* the expressions in the array. With the :operator:`$and`
17+ operator, MongoDB performs a short-circuit evaluation of the
18+ expressions. If the first expression ``<expression1>`` evaluates to
19+ ``false``, MongoDB will skip the evaluation of the remaining
20+ expressions.
1721
1822 Consider the following example:
1923
2731 - ``price`` field value equals ``1.99`` **and**
2832 - ``qty`` field value is less than ``20`` **and**
2933 - ``sale`` field value is equal to ``true``.
30-
34+
3135 MongoDB provides an implicit ``AND`` operation when specifying a
3236 comma separated list of expressions. For example, you may write the
3337 above query as:
You can’t perform that action at this time.
0 commit comments