Skip to content

$maxDistance appears to require degrees rather than radians #1393

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

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
.. important:: MongoDB allows *only one* geospatial index per
.. important:: MongoDB allows *only one* type of geospatial index per
collection. You can create either a |first-geo-index| **or** a
|second-geo-index| per collection.
2 changes: 1 addition & 1 deletion source/reference/operator/query/maxDistance.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ $maxDistance
geospatial :query:`$near` or :query:`$nearSphere` query to the
specified distance. The measuring units for the maximum distance are
determined by the coordinate system in use. For :term:`GeoJSON` point
object, specify the distance in meters, not radians.
object, specify the distance in meters, not degrees.

The ``2d`` and ``2dsphere`` geospatial indexes both support
:query:`$maxDistance`.
Expand Down
8 changes: 4 additions & 4 deletions source/reference/operator/query/near.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ $near
:query:`$near` query to return only those documents that fall
within a maximum distance of a point. If you query for a GeoJSON
point, specify :query:`$maxDistance` in meters. If you query for
legacy coordinate pairs, specify :query:`$maxDistance` in radians.
legacy coordinate pairs, specify :query:`$maxDistance` in degrees.

The :query:`$near` operator requires a geospatial index: a
``2dsphere`` index for GeoJSON points; a ``2d`` index for legacy
coordinate pairs. By default, queries that use a ``2d`` index
return a limit of 100 documents; however you may use
return a maximum of 100 documents; however you may use
:method:`~cursor.limit()` to change the number of results.

.. TODO remove the following "include" statement in 2.6
Expand Down Expand Up @@ -77,9 +77,9 @@ $near
.. important:: If you use longitude and latitude, specify **longitude first**.

The following example query returns documents with location values
that are 10 or fewer units from the point ``[ 40 , 5 ]``.
that are 10 or fewer coordinate degrees from the point ``[ 40 , 5 ]``.

For GeoJSON point object, specify the $maxDistance in meters, not radians.
For GeoJSON point object, specify the $maxDistance in meters, not degrees.

.. code-block:: javascript

Expand Down