diff --git a/source/reference/operator/and.txt b/source/reference/operator/and.txt index 8a4bc62734b..7d5561e421f 100644 --- a/source/reference/operator/and.txt +++ b/source/reference/operator/and.txt @@ -10,10 +10,14 @@ $and *Syntax*: ``{ $and: [ { }, { } , ... , { } ] }`` - :operator:`$and` performs a logical ``AND`` operation on an array - of *two or more* expressions (e.g. ````, + :operator:`$and` performs a logical ``AND`` operation on an array of + *two or more* expressions (e.g. ````, ````, etc.) and selects the documents that satisfy - *all* the expressions in the array. + *all* the expressions in the array. With the :operator:`$and` + operator, MongoDB performs a short-circuit evaluation of the + expressions. If the first expression ```` evaluates to + ``false``, MongoDB will skip the evaluation of the remaining + expressions. Consider the following example: @@ -27,7 +31,7 @@ $and - ``price`` field value equals ``1.99`` **and** - ``qty`` field value is less than ``20`` **and** - ``sale`` field value is equal to ``true``. - + MongoDB provides an implicit ``AND`` operation when specifying a comma separated list of expressions. For example, you may write the above query as: