diff --git a/source/reference/operator/aggregation/geoNear.txt b/source/reference/operator/aggregation/geoNear.txt index e5ff8a25a08..b964c806c2e 100644 --- a/source/reference/operator/aggregation/geoNear.txt +++ b/source/reference/operator/aggregation/geoNear.txt @@ -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 ` - - - The point for which to find the closest documents. - - If using a :doc:`2dsphere ` index, you can specify - the point as either a GeoJSON point or legacy coordinate pair. - - If using a :doc:`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 ` - indexes and planar geometry for :doc:`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 `. - - - - * - ``query`` - - - document - - - Optional. Limits the results to the documents that match the query. The query - syntax is the usual MongoDB :ref:`read operation query - ` 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 `. + + + * - ``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 ` + + - The point for which to find the closest documents. + + If using a :doc:`2dsphere ` index, you can specify + the point as either a GeoJSON point or legacy coordinate pair. + + If using a :doc:`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 + ` 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 ` + indexes and planar geometry for :doc:`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 + +