@@ -4,14 +4,12 @@ Using Geospatial Data
44
55.. default-domain:: mongodb
66
7- MongoDB supports location-based applications using geospatial
8- coordinate with rich location aware queries that return documents
9- based on location, and a special geospatial index type to support
10- these queries. This document introduces geospatial data modeling,
11- indexing operations, and queries using the special :ref:`geospatial
12- query operators <geospatial-query-operators>`. For more information about
13- the geospatial indexes and its operations see :doc:`Geospatial Indexes
14- </core/geospatial-indexes>`.
7+ MongoDB provides rich location aware queries that return documents
8+ based on location with a special geospatial index type. This document
9+ introduces geospatial data modeling, indexing operations, and provides
10+ example queries using the :ref:`geospatial query operators
11+ <geospatial-query-operators>`. For more information about the
12+ geospatial indexes and operations see the :doc:`/applications/geospatial-indexes`.
1513
1614.. _geospatial-coordinates:
1715
4745~~~~~
4846
4947You can use the :func:`find() <db.collection.find()>` method to query
50- directly for an exact match on a location. These queries take the
48+ for an exact match on a location. These queries take the
5149following prototypical form:
5250
5351.. code-block:: javascript
@@ -63,7 +61,7 @@ field that are exactly ``[ 42, 42 ]``, consider the following example:
6361
6462 db.places.find( { "loc": [ 42, 42 ] } )
6563
66- Exact geospatial queries are only useful in a limited selection of
64+ Exact geospatial queries only have applicability for a limited selection of
6765cases, :ref:`proximity <geospatial-query-proximity>` and :ref:`bounded
6866<geospatial-query-bounded>` provide more useful results.
6967
@@ -96,8 +94,8 @@ This operation will return documents from a collection named
9694coordinates ``[ -74, 40.74 ]``.
9795
9896In addition to :operator:`near`, the :dbcommand:`geoNear` command
99- provides equivalent geospatial query functionality, but provides
100- additional options * and* returns additional information for each
97+ provides equivalent functionality. :dbcommand:`geoNear` adds
98+ additional options and returns more information for each
10199document found. In its most simple form, the :dbcommand:`geoNear`
102100command has the following prototype form:
103101
@@ -166,25 +164,24 @@ provides the :operator:`$maxDistance` operator that you can use in
166164
167165 db.runCommand( { geoNear: "collection", near: [ x, y ], maxDistance: z } )
168166
169- The distance specified in :operator:` maxDistance` is in the same units
170- as the coordinate system specifed . For example, if the indexed
171- location data is in meters, the distance unit is also in meters.
167+ Specify the distance in the `` maxDistance`` option using the same units
168+ as the coordinate system specified . For example, if the indexed
169+ location data is in meters, the distance units are also in meters.
172170
173171.. _geospatial-within:
174172.. _geospatial-query-bounded:
175173
176174Bounded
177175~~~~~~~
178176
179- MongoDB provides the ability to return documents using geospatial
180- index that have coordinates located inside of a bounded shape. Bounded
181- queries use the :operator:`$within` operator, and MongoDB does not
182- sort the result set. Because result sets from bounded queries are not
183- sorted, they are faster than :ref:`proximity
177+ Bounded queries return results within the boundaries of a shape
178+ specified in the query. The :operator:`$within` operator allows you to
179+ construct these quires. Bounded queries do not return sorted results:
180+ as a result these queries are faster than :ref:`proximity
184181<geospatial-query-proximity>` queries.
185182
186- The :operator:`$within` operator returns points within the following
187- shapes:
183+ Using the :operator:`$within`, you can specify boundaries with the
184+ following shapes:
188185
189186- circles,
190187- rectangles (i.e. "boxes,") or
@@ -322,7 +319,6 @@ you specify the ``{ spherical: true }`` option to the command.
322319 The radius of the Earth is ``3963.192`` miles or ``6378.137``
323320 kilometers.
324321
325-
326322The following query would return documents from the ``places``
327323collection, within the circle described by the center ``[ -74, 40.74 ]``
328324with a radius of ``100`` kilometers:
@@ -429,4 +425,7 @@ in the following example:
429425
430426 db.records.ensureIndex( { "addresses.loc": "2d" } )
431427
428+ .. the following is a section about the limitations of geospatial
429+ indexes in sharding:
430+
432431.. includes:: /includes/geospatial-sharding.rst
0 commit comments