@@ -44,7 +44,7 @@ snippet to insert documents that describe fruits into the ``myDB.fruits`` collec
44
44
45
45
await myColl.insertMany([
46
46
{ "_id": 1, "name": "apples", "qty": 5, "rating": 3 },
47
- { "_id": 2, "name": "bananas", "qty": 7, "rating": 1, "microsieverts ": 0.1 },
47
+ { "_id": 2, "name": "bananas", "qty": 7, "rating": 1, "color ": "yellow" },
48
48
{ "_id": 3, "name": "oranges", "qty": 6, "rating": 2 },
49
49
{ "_id": 4, "name": "avocados", "qty": 3, "rating": 5 },
50
50
]);
@@ -178,12 +178,12 @@ Element Operators
178
178
179
179
Element operators allow you to query based on the presence, absence, or
180
180
type of a field. The following operation uses the element operator
181
- ``$exists`` to search for documents containing the ``microsieverts ``
181
+ ``$exists`` to search for documents containing the ``color ``
182
182
field:
183
183
184
184
.. code-block:: javascript
185
185
186
- const query = { microsieverts : { $exists: true } };
186
+ const query = { color : { $exists: true } };
187
187
const cursor = myColl.find(query);
188
188
for await (const doc of cursor) {
189
189
console.dir(doc);
@@ -194,7 +194,7 @@ This code snippet returns the following results:
194
194
.. code-block:: javascript
195
195
:copyable: false
196
196
197
- { "_id": 2, "name": "bananas", "qty": 7, "rating": 1, "microsieverts ": 0.1 }
197
+ { "_id": 2, "name": "bananas", "qty": 7, "rating": 1, "color ": "yellow" }
198
198
199
199
For more information on this operator, see the reference manual entry for
200
200
the :manual:`$exists operator </reference/operator/query/exists/>`.
0 commit comments