You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I tried to add a $geoWithin constraint to a Parse.Query like so:
var query = new Parse.Query("MyCollection");
var jsonQuery = query.toJSON();
jsonQuery.where.location = {
"$geoWithin": {
"$centerSphere": [
[geoPoint.longitude, geoPoint.latitude],
10 / 6371.0
]
}
};
query.withJSON(jsonQuery);
It throws the error:
bad $geoWithin value; $polygon should contain at least 3 GeoPoints.
The reason is apparently that Parse Server's Mongo Transformer only accepts a polygon parameter with $geoWithin.
The advantage of a $geoWithin.$centerSphere constraint vs. the existing withinKilometers constraint is that is is not using $near to sort the results by distance and therefore executed faster.
How can I add a query constraint that limits the results to documents with a location field within a certain radius in km of a geo coordinate?
If not I'll do to a PR.
The text was updated successfully, but these errors were encountered:
I tried to add a
$geoWithin
constraint to aParse.Query
like so:It throws the error:
The reason is apparently that Parse Server's Mongo Transformer only accepts a polygon parameter with
$geoWithin
.The advantage of a
$geoWithin.$centerSphere
constraint vs. the existingwithinKilometers
constraint is that is is not using$near
to sort the results by distance and therefore executed faster.How can I add a query constraint that limits the results to documents with a location field within a certain radius in km of a geo coordinate?
If not I'll do to a PR.
The text was updated successfully, but these errors were encountered: