@@ -97,7 +97,6 @@ operators, refer to the :doc:`/applications/read` page of the
9797 wrapper for the more formal query structure with the
9898 :operator:`$query` operator.
9999
100-
101100.. _read-operations-query-document:
102101.. _read-operations-query-argument:
103102
@@ -669,7 +668,7 @@ Cursors
669668The :method:`find() <db.collection.find()>` method returns a
670669:term:`cursor` to the results; however, in the :program:`mongo` shell,
671670if the returned cursor is not assigned to a variable, then the cursor
672- is automatically iterated up to 20 times [#setShellBatchSize ]_ to print
671+ is automatically iterated up to 20 times [#set-shell-batch-size ]_ to print
673672up to the first 20 documents that match the query, as in the following
674673example:
675674
@@ -680,8 +679,8 @@ example:
680679When you assign the :method:`find() <db.collection.find()>` to a
681680variable:
682681
683- - you can type the name of the cursor variable to iterate up to 20
684- times [#setShellBatchSize ]_ and print the matching documents, as in
682+ - you can call the cursor variable in the shell to iterate up to 20
683+ times [#set-shell-batch-size ]_ and print the matching documents, as in
685684 the following example:
686685
687686 .. code-block:: javascript
@@ -696,25 +695,20 @@ variable:
696695 .. code-block:: javascript
697696
698697 var myCursor = db.inventory.find( { type: 'food' } );
699-
700698 var myDocument = myCursor.hasNext() ? myCursor.next() : null;
701699
702700 if (myDocument) {
703-
704701 var myItem = myDocument.item;
705-
706702 print(tojson(myItem));
707703 }
708704
709- To print, you can also use the ``printjson()`` method instead of
710- ``print(tojson())``:
705+ As an alternative print operation, cosider the the ``printjson()``
706+ helper method to replace ``print(tojson())``:
711707
712708 .. code-block:: javascript
713709
714- if (myDocument) {
715-
710+ if (myDocument) {
716711 var myItem = myDocument.item;
717-
718712 printjson(myItem);
719713 }
720714
@@ -732,13 +726,8 @@ See :ref:`JavaScript cursor methods <js-query-cursor-methods>` and your
732726:doc:`driver </applications/drivers>` documentation for more
733727information on cursor methods.
734728
735- .. [#setShellBatchSize] You can use the ``DBQuery.shellBatchSize`` to
736- change the number of iteration from the default value ``20``, as in the
737- following example which sets the number to ``10``:
738-
739- .. code-block:: javascript
740-
741- DBQuery.shellBatchSize = 10
729+ .. [#set-shell-batch-size] You can use the ``DBQuery.shellBatchSize`` to
730+ change the number of iteration from the default value ``20``.
742731
743732Iterator Index
744733~~~~~~~~~~~~~~
@@ -788,11 +777,11 @@ Consider the following behaviors related to cursors:
788777 should either close the cursor manually or exhaust the cursor. In the
789778 :program:`mongo` shell, you can set the ``noTimeout`` flag
790779 [#queryOptions]_:
791-
792- .. code-block:: javascript
793-
780+
781+ .. code-block:: javascript
782+
794783 var myCursor = db.inventory.find().addOption(DBQuery.Option.noTimeout);
795-
784+
796785 See your :doc:`driver </applications/drivers>` documentation for
797786 information on setting the ``noTimeout`` flag.
798787
0 commit comments