[DOCS-8123] $geoNear distanceMultiplier Created: 17/Jun/16  Updated: 30/Oct/23

Status: Closed
Project: Documentation
Component/s: manual, Server
Affects Version/s: None
Fix Version/s: Server_Docs_20231030

Type: Improvement Priority: Minor - P4
Reporter: Jake Angerman Assignee: Kay Kim (Inactive)
Resolution: Won't Do Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Participants:
Days since reply: 1 year, 14 weeks, 2 days ago
Epic Link: DOCSP-1769

 Description   

There are discrepancies on the units used for various fields for $geoNear.

The description for the distanceMultiplier field for $geoNear says

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.

Also, the description for minDistance says,

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

however a 2dsphere index will convert legacy coordinate pairs to GeoJSON Point. So I can have a field like this:

"p": [ -100.8, 33.1875 ]

whose 2dsphere index will convert it into

{ type: "Point", coordinates: [ -100.8, 33.1875 ] }

such that I can specify minDistance in meters even though the documentation says it should be in radians.

The near field sheds some light:

If using a 2dsphere index, you can specify the point as either a GeoJSON point or legacy coordinate pair. If using a 2d index, specify the point as a legacy coordinate pair.

So the main factor appears to be the index used (2dsphere vs 2d) instead of whether the point is GeoJSON or legacy coordinate pair.

Comment on: "reference/operator/aggregation/geoNear.txt"



 Comments   
Comment by Education Bot [ 31/Oct/22 ]

Hello! This ticket has been closed due to inactivity. If you believe this ticket is still important, please reopen it and leave a comment to explain why. Thank you!

Generated at Thu Feb 08 07:55:41 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.