@@ -15,7 +15,7 @@ Access Data From a Cursor
15
15
:values: reference
16
16
17
17
.. meta::
18
- :keywords: read, results, oplog
18
+ :keywords: read, results, code example
19
19
20
20
Overview
21
21
--------
@@ -39,7 +39,7 @@ database from the :atlas:`Atlas sample datasets </sample-data>`. To access this
39
39
from your PHP application, instantiate a ``MongoDB\Client`` that connects to an Atlas cluster
40
40
and assign the following value to your ``collection`` variable:
41
41
42
- .. literalinclude:: /includes/read/distinct .php
42
+ .. literalinclude:: /includes/read/cursor .php
43
43
:language: php
44
44
:dedent:
45
45
:start-after: start-db-coll
@@ -71,9 +71,9 @@ cursor returned by the ``find()`` method:
71
71
.. output::
72
72
:visible: false
73
73
74
- { "_id" : { "$oid" : "..." }, ... "name" : "Dunkin' Donuts", "restaurant_id" : "40379573" }
75
- { "_id" : { "$oid" : "..." }, ... "name" : "Dunkin' Donuts", "restaurant_id" : "40363098" }
76
- { "_id" : { "$oid" : "..." }, ... "name" : "Dunkin' Donuts", "restaurant_id" : "40395071" }
74
+ {"_id":{ "$oid": "..."}, ..."name": "Dunkin' Donuts","restaurant_id": "40379573"}
75
+ {"_id":{ "$oid": "..."}, ..."name": "Dunkin' Donuts","restaurant_id": "40363098"}
76
+ {"_id":{ "$oid": "..."}, ..."name": "Dunkin' Donuts","restaurant_id": "40395071"}
77
77
...
78
78
79
79
Retrieve Documents Individually
@@ -99,7 +99,7 @@ of ``'Dunkin' Donuts'``. Then, it prints the first retrieved document by calling
99
99
100
100
.. output::
101
101
102
- { "_id" : { "$oid" : "..." }, ... "name" : "Dunkin' Donuts", "restaurant_id" : "40379573" }
102
+ {"_id":{ "$oid": "..."}, ..."name": "Dunkin' Donuts","restaurant_id": "40379573"}
103
103
104
104
Retrieve All Documents
105
105
----------------------
@@ -151,8 +151,8 @@ collection. After the cursor is exhausted, it remains open until retrieving thre
151
151
152
152
.. output::
153
153
154
- { "_id" : { "$oid" : "..." }, "name" : "cauliflower" }
155
- { "_id" : { "$oid" : "..." }, "name" : "zucchini" }
154
+ {"_id":{ "$oid": "..."}, "name": "cauliflower"}
155
+ {"_id":{ "$oid": "..."}, "name": "zucchini"}
156
156
157
157
If you insert another document into the ``vegetables`` collection, the preceding code prints
158
158
the new document and closes the ``while`` loop.
@@ -167,9 +167,9 @@ To learn more about read operations, see the :ref:`php-retrieve` guide.
167
167
168
168
To learn more about cursors, see the following pages in the PHP manual:
169
169
170
- - `MongoDB\Driver\Cursor <{+php-manual+}/class.mongodb-driver-cursor.php>`__
171
- - `MongoDB\Driver\Cursor::current() <{+php-manual+}/mongodb-driver-cursor.current.php>`__
172
- - `MongoDB\Driver\Cursor::toArray() <{+php-manual+}/mongodb-driver-cursor.toarray.php>`__
170
+ - `MongoDB\\ Driver\ \Cursor <{+php-manual+}/class.mongodb-driver-cursor.php>`__
171
+ - `MongoDB\\ Driver\ \Cursor::current() <{+php-manual+}/mongodb-driver-cursor.current.php>`__
172
+ - `MongoDB\\ Driver\ \Cursor::toArray() <{+php-manual+}/mongodb-driver-cursor.toarray.php>`__
173
173
174
174
API Documentation
175
175
~~~~~~~~~~~~~~~~~
0 commit comments