Skip to content

Commit 31b4869

Browse files
(DOCSP-26616): Clarify node driver output (#2380)
* (DOCSP-26616): Clarify node driver output * cleanup * wording * move include location * move blurb higher up on page * edits * remove extra lines * minimalism * wording * apply text to all query documents pages * wording * add include to query for null page * move include location * formatting * wording * clarifications based on review * formatting
1 parent fdd8e08 commit 31b4869

File tree

3 files changed

+42
-12
lines changed

3 files changed

+42
-12
lines changed

source/tutorial/query-arrays.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,4 +148,3 @@ For additional query examples, see:
148148
- :doc:`/tutorial/query-embedded-documents`
149149

150150
- :doc:`/tutorial/query-array-of-documents`
151-

source/tutorial/query-documents.txt

Lines changed: 42 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,8 @@ Select All Documents in a Collection
4343

4444
.. include:: /includes/driver-examples/driver-example-query-7.rst
4545

46-
This operation corresponds to the following SQL statement:
46+
This operation uses a filter predicate of ``{}``, which corresponds to
47+
the following SQL statement:
4748

4849
.. code-block:: sql
4950

@@ -80,7 +81,8 @@ This operation corresponds to the following SQL statement:
8081

8182
- id: nodejs
8283
content: |
83-
For more information on the syntax of the method, see
84+
85+
To see supported options for the ``find()`` method, see
8486
:node-api:`find() <Collection.html#find>`.
8587

8688
- id: php
@@ -120,7 +122,8 @@ documents where the ``status`` equals ``"D"``:
120122

121123
.. include:: /includes/driver-examples/driver-example-query-9.rst
122124

123-
This operation corresponds to the following SQL statement:
125+
This operation uses a filter predicate of ``{ status: "D" }``, which
126+
corresponds to the following SQL statement:
124127

125128
.. code-block:: sql
126129

@@ -153,7 +156,9 @@ collection where ``status`` equals either ``"A"`` or ``"D"``:
153156
use the :query:`$in` operator rather than the :query:`$or`
154157
operator when performing equality checks on the same field.
155158

156-
The operation corresponds to the following SQL statement:
159+
The operation uses a filter predicate of
160+
``{ status: { $in: [ "A", "D" ] } }``, which corresponds to the
161+
following SQL statement:
157162

158163
.. code-block:: sql
159164

@@ -176,7 +181,9 @@ than (:query:`$lt`) ``30``:
176181

177182
.. include:: /includes/driver-examples/driver-example-query-11.rst
178183

179-
The operation corresponds to the following SQL statement:
184+
The operation uses a filter predicate of
185+
``{ status: "A", qty: { $lt: 30 } }``, which corresponds to the
186+
following SQL statement:
180187

181188
.. code-block:: sql
182189

@@ -199,18 +206,21 @@ the ``status`` equals ``"A"`` **or** ``qty`` is less than
199206

200207
.. include:: /includes/driver-examples/driver-example-query-12.rst
201208

202-
The operation corresponds to the following SQL statement:
209+
The operation uses a filter predicate of
210+
``{ $or: [ { status: 'A' }, { qty: { $lt: 30 } } ] }``, which
211+
corresponds to the following SQL statement:
203212

204213
.. code-block:: sql
205214

206215
SELECT * FROM inventory WHERE status = "A" OR qty < 30
207216

208217
.. note::
209-
Queries which use :ref:`comparison operators <query-selectors-comparison>`
210-
are subject to :ref:`type-bracketing`.
218+
219+
Queries that use :ref:`comparison operators
220+
<query-selectors-comparison>` are subject to :ref:`type-bracketing`.
211221

212222
Specify ``AND`` as well as ``OR`` Conditions
213-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
223+
--------------------------------------------
214224

215225
In the following example, the compound query document selects all
216226
documents in the collection where the ``status`` equals ``"A"``
@@ -219,7 +229,18 @@ documents in the collection where the ``status`` equals ``"A"``
219229

220230
.. include:: /includes/driver-examples/driver-example-query-13.rst
221231

222-
The operation corresponds to the following SQL statement:
232+
The operation uses a filter predicate of:
233+
234+
.. code-block:: javascript
235+
236+
{
237+
status: 'A',
238+
$or: [
239+
{ qty: { $lt: 30 } }, { item: { $regex: '^p' } }
240+
]
241+
}
242+
243+
which corresponds to the following SQL statement:
223244

224245
.. code-block:: sql
225246

@@ -349,6 +370,17 @@ For reads to :doc:`replica sets </replication>` and replica set
349370
level of isolation for their reads. For more information, see
350371
:doc:`/reference/read-concern`.
351372

373+
Query Result Format
374+
~~~~~~~~~~~~~~~~~~~
375+
376+
When you run a find operation with a MongoDB driver or ``mongosh``, the
377+
command returns a :term:`cursor` that manages query results. The query
378+
results are not returned as an array of documents.
379+
380+
To learn how to iterate through documents in a cursor, refer to your
381+
:driver:`driver's documentation </>`. If you are using ``mongosh``, see
382+
:ref:`read-operations-cursors`.
383+
352384
.. tabs-drivers::
353385

354386
tabs:

source/tutorial/query-for-null-fields.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -370,4 +370,3 @@ The query only returns the document that does *not* contain the
370370
.. [#type0]
371371

372372
.. include:: /includes/extracts/4.2-changes-type-0.rst
373-

0 commit comments

Comments
 (0)