@@ -47,16 +47,17 @@ following form:
4747
4848 .. code-block:: javascript
4949
50- db.places.find( { loc: {$near: [-70,40 ] } })
50+ db.places.find( { loc: { $near: [ -70, 40 ] } } )
5151
5252 returns output similar to the following:
5353
5454 .. code-block:: javascript
5555
56- { "_id" : ObjectId(" ... "), "loc" : [ -73, 40 ] }
56+ { "_id" : ObjectId(" ... "), "loc" : [ -73, 39 ] }
5757
5858The :dbcommand:`geoNear` command returns more information than does the
59- :operator:`$near` operator but does not sort results. The
59+ :operator:`$near` operator. The :dbcommand:`geoNear` command can only
60+ return a single 16-megabyte result set. The
6061:dbcommand:`geoNear` command also offers additional operators, such as
6162operators to query for :ref:`maximum <geospatial-indexes-distance>` or
6263:ref:`spherical <geospatial-indexes-spherical>` distance. For a list of
@@ -84,15 +85,14 @@ following form:
8485
8586 {
8687 "ns" : "test.places",
87- "near" : "0110000111111000000111111000000111111000000111111000",
8888 "results" : [
8989 {
9090 "dis" : 3,
9191 "obj" : {
9292 "_id" : ObjectId(" ... "),
9393 "loc" : [
9494 -73,
95- 40
95+ 39
9696 ]
9797 }
9898 }
@@ -105,6 +105,7 @@ following form:
105105 "avgDistance" : 3,
106106 "maxDistance" : 3.0000188685220253
107107 },
108+ "near" : "0110000111111000000111111000000111111000000111111000",
108109 "ok" : 1
109110 }
110111
@@ -124,14 +125,14 @@ method, use :operator:`$maxDistance` operator. Use the following form:
124125
125126.. code-block:: javascript
126127
127- db.collection.find( { <location field>: { $near: [ x, y ] } , $maxDistance : z } )
128+ db.collection.find( { <location field> : { $near : [ x , y ] , $maxDistance : <distance> } } )
128129
129130To specify distance with the :dbcommand:`geoNear` command, use the
130131``maxDistance`` option. Use the following form:
131132
132133.. code-block:: javascript
133134
134- db.runCommand( { geoNear: "collection", near: [ x, y ], maxDistance: z } )
135+ db.runCommand( { geoNear: "collection", near: [ x, y ], maxDistance: <distance> } )
135136
136137.. _geospatial-indexes-limit:
137138
@@ -140,9 +141,7 @@ Limit the Number of Results
140141
141142By default, geospatial queries using :method:`find()
142143<db.collection.find()>` method return 100 documents, sorted by
143- distance.
144-
145- To limit the result when using the :method:`find()
144+ distance. To limit the result when using the :method:`find()
146145<db.collection.find()>` method, use the :method:`limit()
147146<cursor.limit()>` method, as in the following prototype:
148147
@@ -151,30 +150,14 @@ To limit the result when using the :method:`find()
151150 db.collection.find( { <location field>: { $near: [ x, y ] } } ).limit(<n>)
152151
153152To limit the result set when using the :dbcommand:`geoNear` command, use
154- the ``num`` option. The following is a prototype of the command :
153+ the ``num`` option. Use the following form :
155154
156155.. code-block:: javascript
157156
158157 db.runCommand( { geoNear: "collection", near: [ x, y ], num: z } )
159158
160- The :method:`limit() <cursor.limit()>` method and ``near`` parameter
161- to :dbcommand:`geoNear` do not limit geospatial query results by
162- distance, only the number of results. To limit geospatial search
163- results by distance, please see the :ref:`geospatial-indexes-distance`
164- section.
165-
166- .. note::
167-
168- The :method:`limit() <cursor.limit()>` method and ``num`` option have
169- different performance characteristics. Geospatial queries using
170- :method:`limit() <cursor.limit()>` method are slower than using
171- :dbcommand:`geoNear`.
172-
173- Geospatial queries with the :method:`find() <db.collection.find()>`
174- method will return 100 documents, sort them, and finally limit the
175- result set. Geospatial queries with the :dbcommand:`geoNear` and
176- ``num`` option will only return the specified number of unsorted
177- documents.
159+ To limit geospatial search results by distance, see
160+ :ref:`geospatial-indexes-distance`.
178161
179162.. _geospatial-indexes-within:
180163.. _geospatial-indexes-bounded:
0 commit comments