@@ -49,8 +49,8 @@ Find Documents
49
49
50
50
The {+php-library+} includes two methods for retrieving documents from a collection:
51
51
``MongoDB\Collection::findOne()`` and ``MongoDB\Collection::find()``. These methods
52
- take a **query filter** and return one or more matching documents. A query filter is
53
- an object that specifies the documents you want to retrieve in your query.
52
+ take a **query filter** and return one or more matching documents. A query filter
53
+ specifies the search criteria that the driver uses to retrieve documents in your query.
54
54
55
55
.. TODO: To learn more about query filters, see :ref:`php-specify-query`.
56
56
@@ -79,6 +79,7 @@ The following example uses the ``findOne()`` method to find the first document i
79
79
the ``name`` field has the value ``'LinkedIn'``:
80
80
81
81
.. io-code-block::
82
+ :copyable:
82
83
83
84
.. input:: /includes/read/retrieve.php
84
85
:start-after: start-find-one
@@ -126,6 +127,7 @@ You can iterate over the documents in a cursor by using a ``foreach`` loop, as s
126
127
the following example:
127
128
128
129
.. io-code-block::
130
+ :copyable:
129
131
130
132
.. input:: /includes/read/retrieve.php
131
133
:start-after: start-cursor
@@ -163,7 +165,7 @@ Modify Find Behavior
163
165
164
166
You can modify the behavior of the ``MongoDB\Collection::find()`` and
165
167
``MongoDB\Collection::findOne()`` methods by passing an array that specifies
166
- option values as a parameter. The following table describes some of the options
168
+ option values as a parameter. The following table describes some options
167
169
you can set in the array:
168
170
169
171
.. list-table::
@@ -209,8 +211,8 @@ you can set in the array:
209
211
| **Type**: ``array``
210
212
211
213
The following example uses the ``find()`` method to find all documents in which
212
- the ``number_of_employees`` field has the value ``1000`` and instructs the
213
- operation to return a maximum of ``5`` results:
214
+ the ``number_of_employees`` field has the value ``1000``. The example uses the
215
+ ``limit`` option to return a maximum of ``5`` results:
214
216
215
217
.. literalinclude:: /includes/read/retrieve.php
216
218
:language: php
0 commit comments