-
-
Notifications
You must be signed in to change notification settings - Fork 105
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
Added geoNear aggregate stage. #242
Conversation
Also important to Note that we have 2 separate |
That is problematic API |
The |
geoNear["minDistance"] = minDistance | ||
} | ||
|
||
if let key = key { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can assign a String?
directly to a Document. If it's nil
it won't be inserted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should simplify this code a LOT
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah that’s good to know. Thanks for the tip. Will update.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Resolved
if useLegacy { | ||
geoNear["near"] = coordinates.makePrimitive() | ||
} else { | ||
geoNear["near"] = ["type": "Point", "coordinates": coordinates] as Document |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I assume that geoNear only supports a point
, right?
Looking at the API a second time makes me wonder whether useLegacy
should be a boolean option.
Also, coordinates is either 2 or 3 coordinates if I remember correctly. In which case the [Double]
is fine. But I'm wondering if that API could be changed to be less prone to error. A good example of an error that I keep making is the order of latitude
and longitude
.
I also wonder whether uniqueDocs
should be written out fully as uniqueDocuments
, irregardless of MongoDB's documentation.
These are not decisions, but something I'd wish to discuss before merging for sure.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also updated these.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nothing to add anymore
Description
This PR adds support for the
$geoNear
aggregate stageMotivation and Context
This adds more missing API to aggregate stages.
Checklist: