Skip to content

Commit 6bccf06

Browse files
ianf-mongodbandf-mongodb
authored andcommitted
DOCSP-16410 sensibility order options under geonear
1 parent e6d6e50 commit 6bccf06

File tree

1 file changed

+99
-109
lines changed

1 file changed

+99
-109
lines changed

source/reference/operator/aggregation/geoNear.txt

Lines changed: 99 additions & 109 deletions
Original file line numberDiff line numberDiff line change
@@ -37,150 +37,140 @@ Definition
3737
.. list-table::
3838
:header-rows: 1
3939
:widths: 20 20 80
40-
40+
4141
* - Field
42-
42+
4343
- Type
44-
44+
4545
- Description
46-
47-
* - ``near``
48-
49-
- GeoJSON point or :term:`legacy coordinate pair <legacy coordinate pairs>`
50-
51-
- The point for which to find the closest documents.
52-
53-
If using a :doc:`2dsphere </core/2dsphere>` index, you can specify
54-
the point as either a GeoJSON point or legacy coordinate pair.
55-
56-
If using a :doc:`2d </core/2d>` index, specify the point as a legacy
57-
coordinate pair.
58-
59-
60-
46+
47+
6148
* - ``distanceField``
62-
49+
6350
- string
64-
51+
6552
- The output field that contains the
6653
calculated distance. To specify a field within an embedded document,
6754
use :term:`dot notation`.
68-
69-
70-
71-
* - ``spherical``
72-
73-
- boolean
74-
75-
- Optional. Determines how MongoDB calculates the distance between two points:
76-
77-
- When ``true``, MongoDB uses :query:`$nearSphere` semantics and
78-
calculates distances using spherical geometry.
79-
80-
- When ``false``, MongoDB uses :query:`$near` semantics:
81-
spherical geometry for :doc:`2dsphere </core/2dsphere>`
82-
indexes and planar geometry for :doc:`2d </core/2d>` indexes.
83-
84-
*Default: false.*
85-
86-
87-
88-
* - ``maxDistance``
89-
90-
- number
91-
92-
- Optional. The maximum distance from the center point that the documents *can*
93-
be. MongoDB limits the results to those documents that fall within
94-
the specified distance from the center point.
95-
96-
Specify the distance in meters if the specified point is
97-
:term:`GeoJSON` and in radians if the specified point is
98-
:term:`legacy coordinate pairs <legacy coordinate pairs>`.
99-
100-
101-
102-
* - ``query``
103-
104-
- document
105-
106-
- Optional. Limits the results to the documents that match the query. The query
107-
syntax is the usual MongoDB :ref:`read operation query
108-
<read-operations-query-argument>` syntax.
109-
110-
.. include:: /includes/fact-geoNear-restrict-near-in-query.rst
111-
112-
113-
55+
56+
11457
* - ``distanceMultiplier``
115-
58+
11659
- number
117-
60+
11861
- Optional. The factor to multiply all distances returned by the query. For
11962
example, use the ``distanceMultiplier`` to convert radians, as
12063
returned by a spherical query, to kilometers by multiplying by the
12164
radius of the Earth.
122-
123-
124-
65+
66+
12567
* - ``includeLocs``
126-
68+
12769
- string
128-
70+
12971
- Optional. This specifies the output field that identifies the location used to
13072
calculate the distance. This option is useful when a location field
13173
contains multiple locations. To specify a field within an
13274
embedded document, use :term:`dot notation`.
133-
134-
135-
136-
* - ``uniqueDocs``
137-
138-
- boolean
139-
140-
- Optional. If this value is ``true``, the query returns a matching document once,
141-
even if more than one of the document's location fields match the
142-
query.
143-
144-
.. include:: /includes/deprecation-uniqueDocs.rst
145-
146-
147-
148-
* - ``minDistance``
149-
150-
- number
151-
152-
- Optional. The minimum distance from the center point that the documents can
153-
be. MongoDB limits the results to those documents that fall outside
154-
the specified distance from the center point.
155-
156-
Specify the distance in meters for GeoJSON data and in radians for
157-
legacy coordinate pairs.
158-
159-
.. versionadded:: 3.2
160-
161-
162-
75+
16376
* - ``key``
164-
77+
16578
-
166-
79+
16780
- Optional. Specify the geospatial indexed field to use when calculating the
16881
distance.
169-
82+
17083
If your collection has multiple ``2d`` and/or multiple ``2dsphere``
17184
indexes, you **must** use the ``key`` option to specify the indexed
17285
field path to use. :ref:`pipeline-geoNear-key-param-example`
17386
provides a full example.
174-
87+
17588
If there is more than one ``2d`` index or more than one ``2dsphere``
17689
index and you do not specify a ``key``, MongoDB will return an error.
177-
90+
17891
If you do not specify the ``key``, and you have at most only one
17992
``2d`` index and/or only one ``2dsphere`` index, MongoDB looks first
18093
for a ``2d`` index to use. If a ``2d`` index does not exists, then
18194
MongoDB looks for a ``2dsphere`` index to use.
182-
95+
18396
.. versionadded:: 4.0
97+
98+
* - ``maxDistance``
99+
100+
- number
101+
102+
- Optional. The maximum distance from the center point that the documents *can*
103+
be. MongoDB limits the results to those documents that fall within
104+
the specified distance from the center point.
105+
106+
Specify the distance in meters if the specified point is
107+
:term:`GeoJSON` and in radians if the specified point is
108+
:term:`legacy coordinate pairs <legacy coordinate pairs>`.
109+
110+
111+
* - ``minDistance``
112+
113+
- number
114+
115+
- Optional. The minimum distance from the center point that the documents *can*
116+
be. MongoDB limits the results to those documents that fall outside
117+
the specified distance from the center point.
118+
119+
Specify the distance in meters for GeoJSON data and in radians for
120+
legacy coordinate pairs.
121+
122+
.. versionadded:: 3.2
123+
124+
* - ``near``
125+
126+
- GeoJSON point or :term:`legacy coordinate pair <legacy coordinate pairs>`
127+
128+
- The point for which to find the closest documents.
129+
130+
If using a :doc:`2dsphere </core/2dsphere>` index, you can specify
131+
the point as either a GeoJSON point or legacy coordinate pair.
132+
133+
If using a :doc:`2d </core/2d>` index, specify the point as a legacy
134+
coordinate pair.
135+
136+
* - ``query``
137+
138+
- document
139+
140+
- Optional. Limits the results to the documents that match the query. The query
141+
syntax is the usual MongoDB :ref:`read operation query
142+
<read-operations-query-argument>` syntax.
143+
144+
.. include:: /includes/fact-geoNear-restrict-near-in-query.rst
145+
146+
147+
* - ``spherical``
148+
149+
- boolean
150+
151+
- Optional. Determines how MongoDB calculates the distance between two points:
152+
153+
- When ``true``, MongoDB uses :query:`$nearSphere` semantics and
154+
calculates distances using spherical geometry.
155+
156+
- When ``false``, MongoDB uses :query:`$near` semantics:
157+
spherical geometry for :doc:`2dsphere </core/2dsphere>`
158+
indexes and planar geometry for :doc:`2d </core/2d>` indexes.
159+
160+
*Default: false.*
161+
162+
163+
* - ``uniqueDocs``
164+
165+
- boolean
166+
167+
- Optional. If this value is ``true``, the query returns a matching document once,
168+
even if more than one of the document's location fields match the
169+
query.
170+
171+
.. include:: /includes/deprecation-uniqueDocs.rst
172+
173+
184174

185175

186176

0 commit comments

Comments
 (0)