Skip to content

Add support for $minDistance to NearQuery [DATAMONGO-1110] #2027

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
spring-projects-issues opened this issue Dec 3, 2014 · 2 comments
Closed
Assignees
Labels
in: core Issues in core support type: enhancement A general enhancement

Comments

@spring-projects-issues
Copy link

Oliver Drotbohm opened DATAMONGO-1110 and commented


Reference URL: http://stackoverflow.com/questions/27228039/mongodb-spring-data-geonear-query-with-max-and-min-distance

Issue Links:

  • DATAMONGO-1138 Add support for $minDistance in Criteria
    ("is duplicated by")

Referenced from: pull request #277

3 votes, 5 watchers

@spring-projects-issues
Copy link
Author

Christoph Strobl commented

Using $minDistance only works under certain conditions (index / query type):

2d flat 2d sphere
geoNear command [0] (x)
legacy coodrinates [1] (/)
geoJson geometry [2] (x)

[0]

db.runCommand({ "geoNear" : "newyork" , "minDistance" : 1.567855942887398E-4 , "distanceMultiplier" : 6378.137 , "num" : 10 , "near" : [ -73.0 , 40.0] , "spherical" : true});

// or 

db.runCommand({ "geoNear" : "newyork" , "minDistance" : 1.567855942887398E-4 , "distanceMultiplier" : 6378.137 , "num" : 10 , "near" : {"type":"Point", "coordinates":[ -73.0 , 40.0] }, "spherical" : true});

[1]

db.newyork.find({ "location" : { "$near" : { "x" : -73.99171 , "y" : 40.738868} , "$minDistance" : 0.01}})

[2]

db.newyork.find({ "location" : { "$near" : { "$geometry" : { "type":"Point", "coordinates" : [-73.99171,40.738868] }, "$minDistance" : 0.01}}});

@spring-projects-issues
Copy link
Author

Christoph Strobl commented

The PR is split in two parts:

  • 1st: Criteria and Near query support for $minDistance.
  • 2nd: Query derivation stuff

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: core Issues in core support type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

2 participants