Skip to content

DOCSP-16410 sensibility order options under geonear #5516

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
208 changes: 99 additions & 109 deletions source/reference/operator/aggregation/geoNear.txt
Original file line number Diff line number Diff line change
Expand Up @@ -37,150 +37,140 @@ Definition
.. list-table::
:header-rows: 1
:widths: 20 20 80

* - Field

- Type

- Description

* - ``near``

- GeoJSON point or :term:`legacy coordinate pair <legacy coordinate pairs>`

- The point for which to find the closest documents.

If using a :doc:`2dsphere </core/2dsphere>` index, you can specify
the point as either a GeoJSON point or legacy coordinate pair.

If using a :doc:`2d </core/2d>` index, specify the point as a legacy
coordinate pair.





* - ``distanceField``

- string

- The output field that contains the
calculated distance. To specify a field within an embedded document,
use :term:`dot notation`.



* - ``spherical``

- boolean

- Optional. Determines how MongoDB calculates the distance between two points:

- When ``true``, MongoDB uses :query:`$nearSphere` semantics and
calculates distances using spherical geometry.

- When ``false``, MongoDB uses :query:`$near` semantics:
spherical geometry for :doc:`2dsphere </core/2dsphere>`
indexes and planar geometry for :doc:`2d </core/2d>` indexes.

*Default: false.*



* - ``maxDistance``

- number

- Optional. The maximum distance from the center point that the documents *can*
be. MongoDB limits the results to those documents that fall within
the specified distance from the center point.

Specify the distance in meters if the specified point is
:term:`GeoJSON` and in radians if the specified point is
:term:`legacy coordinate pairs <legacy coordinate pairs>`.



* - ``query``

- document

- Optional. Limits the results to the documents that match the query. The query
syntax is the usual MongoDB :ref:`read operation query
<read-operations-query-argument>` syntax.

.. include:: /includes/fact-geoNear-restrict-near-in-query.rst





* - ``distanceMultiplier``

- number

- Optional. The factor to multiply all distances returned by the query. For
example, use the ``distanceMultiplier`` to convert radians, as
returned by a spherical query, to kilometers by multiplying by the
radius of the Earth.





* - ``includeLocs``

- string

- Optional. This specifies the output field that identifies the location used to
calculate the distance. This option is useful when a location field
contains multiple locations. To specify a field within an
embedded document, use :term:`dot notation`.



* - ``uniqueDocs``

- boolean

- Optional. If this value is ``true``, the query returns a matching document once,
even if more than one of the document's location fields match the
query.

.. include:: /includes/deprecation-uniqueDocs.rst



* - ``minDistance``

- number

- Optional. The minimum distance from the center point that the documents can
be. MongoDB limits the results to those documents that fall outside
the specified distance from the center point.

Specify the distance in meters for GeoJSON data and in radians for
legacy coordinate pairs.

.. versionadded:: 3.2




* - ``key``

-

- Optional. Specify the geospatial indexed field to use when calculating the
distance.

If your collection has multiple ``2d`` and/or multiple ``2dsphere``
indexes, you **must** use the ``key`` option to specify the indexed
field path to use. :ref:`pipeline-geoNear-key-param-example`
provides a full example.

If there is more than one ``2d`` index or more than one ``2dsphere``
index and you do not specify a ``key``, MongoDB will return an error.

If you do not specify the ``key``, and you have at most only one
``2d`` index and/or only one ``2dsphere`` index, MongoDB looks first
for a ``2d`` index to use. If a ``2d`` index does not exists, then
MongoDB looks for a ``2dsphere`` index to use.

.. versionadded:: 4.0

* - ``maxDistance``

- number

- Optional. The maximum distance from the center point that the documents *can*
be. MongoDB limits the results to those documents that fall within
the specified distance from the center point.

Specify the distance in meters if the specified point is
:term:`GeoJSON` and in radians if the specified point is
:term:`legacy coordinate pairs <legacy coordinate pairs>`.


* - ``minDistance``

- number

- Optional. The minimum distance from the center point that the documents *can*
be. MongoDB limits the results to those documents that fall outside
the specified distance from the center point.

Specify the distance in meters for GeoJSON data and in radians for
legacy coordinate pairs.

.. versionadded:: 3.2

* - ``near``

- GeoJSON point or :term:`legacy coordinate pair <legacy coordinate pairs>`

- The point for which to find the closest documents.

If using a :doc:`2dsphere </core/2dsphere>` index, you can specify
the point as either a GeoJSON point or legacy coordinate pair.

If using a :doc:`2d </core/2d>` index, specify the point as a legacy
coordinate pair.

* - ``query``

- document

- Optional. Limits the results to the documents that match the query. The query
syntax is the usual MongoDB :ref:`read operation query
<read-operations-query-argument>` syntax.

.. include:: /includes/fact-geoNear-restrict-near-in-query.rst


* - ``spherical``

- boolean

- Optional. Determines how MongoDB calculates the distance between two points:

- When ``true``, MongoDB uses :query:`$nearSphere` semantics and
calculates distances using spherical geometry.

- When ``false``, MongoDB uses :query:`$near` semantics:
spherical geometry for :doc:`2dsphere </core/2dsphere>`
indexes and planar geometry for :doc:`2d </core/2d>` indexes.

*Default: false.*


* - ``uniqueDocs``

- boolean

- Optional. If this value is ``true``, the query returns a matching document once,
even if more than one of the document's location fields match the
query.

.. include:: /includes/deprecation-uniqueDocs.rst





Expand Down