Skip to content

Commit 61bab73

Browse files
committed
DOCSP-5895: fix results for agg $and
1 parent 3470857 commit 61bab73

File tree

1 file changed

+13
-11
lines changed
  • source/reference/operator/aggregation

1 file changed

+13
-11
lines changed

source/reference/operator/aggregation/and.txt

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -79,15 +79,17 @@ evaluation after encountering the first ``false`` expression.
7979
Example
8080
-------
8181

82-
Consider an ``inventory`` collection with the following documents:
82+
Create an example ``inventory`` collection with the following documents:
8383

8484
.. code-block:: javascript
8585

86-
{ "_id" : 1, "item" : "abc1", description: "product 1", qty: 300 }
87-
{ "_id" : 2, "item" : "abc2", description: "product 2", qty: 200 }
88-
{ "_id" : 3, "item" : "xyz1", description: "product 3", qty: 250 }
89-
{ "_id" : 4, "item" : "VWZ1", description: "product 4", qty: 300 }
90-
{ "_id" : 5, "item" : "VWZ2", description: "product 5", qty: 180 }
86+
db.inventory.insertMany([
87+
{ "_id" : 1, "item" : "abc1", description: "product 1", qty: 300 },
88+
{ "_id" : 2, "item" : "abc2", description: "product 2", qty: 200 },
89+
{ "_id" : 3, "item" : "xyz1", description: "product 3", qty: 250 },
90+
{ "_id" : 4, "item" : "VWZ1", description: "product 4", qty: 300 },
91+
{ "_id" : 5, "item" : "VWZ2", description: "product 5", qty: 180 }
92+
])
9193

9294
The following operation uses the :expression:`$and` operator to
9395
determine if ``qty`` is greater than 100 *and* less than ``250``:
@@ -111,8 +113,8 @@ The operation returns the following results:
111113

112114
.. code-block:: javascript
113115

114-
{ "_id" : 1, "item" : "abc1", "result" : false }
115-
{ "_id" : 2, "item" : "abc2", "result" : true }
116-
{ "_id" : 3, "item" : "xyz1", "result" : false }
117-
{ "_id" : 4, "item" : "VWZ1", "result" : false }
118-
{ "_id" : 5, "item" : "VWZ2", "result" : true }
116+
{ "_id" : 1, "item" : "abc1", "qty" : 300, "result" : false }
117+
{ "_id" : 2, "item" : "abc2", "qty" : 200, "result" : true }
118+
{ "_id" : 3, "item" : "xyz1", "qty" : 250, "result" : false }
119+
{ "_id" : 4, "item" : "VWZ1", "qty" : 300, "result" : false }
120+
{ "_id" : 5, "item" : "VWZ2", "qty" : 180, "result" : true }

0 commit comments

Comments
 (0)