@@ -14,7 +14,7 @@ Overview
1414--------
1515
1616In this guide, you can learn how to access data using a **cursor** with the
17- MongoDB Java driver.
17+ MongoDB Java driver.
1818
1919A cursor is a mechanism that allows an application to iterate over database
2020results while only holding a subset of them in memory at a given time. The
@@ -23,7 +23,7 @@ matched documents in batches as opposed to returning them all at once.
2323
2424This page uses an initiating method, ``find()`` to show how to access
2525data from a `FindIterable
26- <{+api+}/apidocs/mongodb-driver-sync/com/mongodb/client/FindIterable.html>`__.
26+ <{+api+}/apidocs/mongodb-driver-sync/com/mongodb/client/FindIterable.html>`__.
2727
2828.. note::
2929
@@ -41,13 +41,13 @@ Terminal Methods
4141
4242Terminal methods execute an operation on the MongoDB server after
4343configuring all parameters of an ``Iterable`` instance controlling the
44- operation.
44+ operation.
4545
4646First
4747~~~~~
4848
4949Use the ``first()`` method to retrieve the first document in your query
50- results:
50+ results:
5151
5252.. literalinclude:: /includes/fundamentals/code-snippets/Cursor.java
5353 :language: java
@@ -56,21 +56,21 @@ results:
5656 :end-before: end firstExample
5757
5858This method is often used when your query filter will match one
59- document, such as when filtering by a unique index.
59+ document, such as when filtering by a unique index.
6060
6161Into
6262~~~~
6363
64- Use the ``into()`` method to store your query results in a ``List``:
64+ Use the ``into()`` method to store your query results in a ``List``:
6565
6666.. literalinclude:: /includes/fundamentals/code-snippets/Cursor.java
6767 :language: java
6868 :dedent:
6969 :start-after: begin intoExample
7070 :end-before: end intoExample
71-
71+
7272This method is often used when your query filter returns a small number
73- of documents that can fit into available memory.
73+ of documents that can fit into available memory.
7474
7575Cursor
7676~~~~~~
@@ -80,7 +80,7 @@ ensure that the cursor closes if there is an early termination:
8080
8181.. code-block:: java
8282 :copyable: true
83-
83+
8484 MongoCursor<Document> cursor = collection.find().cursor();
8585
8686For more information on how to ensure a cursor closes, see the :ref:`cursor cleanup section <cursor_cleanup>`.
@@ -89,17 +89,17 @@ Explain
8989~~~~~~~
9090
9191Use the ``explain()`` method to view information about how MongoDB
92- executes your operation.
92+ executes your operation.
9393
9494The ``explain()`` method returns **execution plans** and performance
9595statistics. An execution plan is a potential way MongoDB
9696can complete an operation. The ``explain()`` method provides both the
97- winning plan (the plan MongoDB executed) and rejected plans.
97+ winning plan (the plan MongoDB executed) and rejected plans.
9898
9999.. include:: /includes/fundamentals/explain-verbosity.rst
100100
101101The following example prints the JSON representation of the
102- winning plan for aggregation stages that produce execution plans:
102+ winning plan for aggregation stages that produce execution plans:
103103
104104.. literalinclude:: /includes/fundamentals/code-snippets/Cursor.java
105105 :language: java
@@ -115,9 +115,9 @@ The preceding code snippet should produce the following output:
115115 { "stage": "COLLSCAN", "direction": "forward" }
116116
117117For more information on the explain operation, see the following
118- Server Manual Entries:
118+ Server Manual Entries:
119119
120- - :manual:`Explain Output </reference/explain-results/>`
120+ - :manual:`Explain Output </reference/explain-results/>`
121121- :manual:`Query Plans </core/query-plans/>`
122122
123123For more information about the methods and classes mentioned in this section,
@@ -133,13 +133,13 @@ Usage Patterns
133133--------------
134134
135135A ``MongoCursor`` and ``FindIterable`` allow you to access query results
136- one document at a time, abstracting away network and caching logic.
136+ one document at a time, abstracting away network and caching logic.
137137
138138Functional Iteration
139139~~~~~~~~~~~~~~~~~~~~~
140140
141141Pass a function to the ``forEach()`` method of a ``FindIterable`` to
142- iterate through results in a functional style:
142+ iterate through results in a functional style:
143143
144144.. literalinclude:: /includes/fundamentals/code-snippets/Cursor.java
145145 :language: java
@@ -151,7 +151,7 @@ iterate through results in a functional style:
151151
152152 Initiating methods return objects that implement the ``Iterable`` interface which allows you
153153 to iterate through them using iterator methods. Sometimes, we use an enhanced
154- for-each loop to iterate through results:
154+ for-each loop to iterate through results:
155155
156156 .. code-block:: java
157157
@@ -167,7 +167,7 @@ iterate through results in a functional style:
167167Conditional Iteration
168168~~~~~~~~~~~~~~~~~~~~~
169169
170- Use the ``hasNext() `` method to check if there are any documents
170+ Use the ``hasNext()`` method to check if there are any documents
171171available in the cursor, and then use the ``next()`` method to retrieve
172172the next available document from the cursor:
173173
@@ -180,7 +180,7 @@ the next available document from the cursor:
180180For more information about the methods and classes mentioned in this section,
181181see the following API Documentation:
182182
183- - `forEach() <https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Iterable.html?is-external=true#forEach(java.util.function.Consumer)>`__
183+ - `forEach() <https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Iterable.html?is-external=true#forEach(java.util.function.Consumer)>`__
184184- `hasNext() <{+api+}/apidocs/mongodb-driver-sync/com/mongodb/client/MongoCursor.html#hasNext()>`__
185185- `next() <{+api+}/apidocs/mongodb-driver-sync/com/mongodb/client/MongoCursor.html#next()>`__
186186
@@ -201,7 +201,7 @@ server:
201201 :dedent:
202202 :start-after: begin closeExample
203203 :end-before: end closeExample
204-
204+
205205Try with Resources Statement
206206~~~~~~~~~~~~~~~~~~~~~~~~~~~~
207207
0 commit comments