parse-server
parse-server copied to clipboard
Issue7480 max distance in kilometers params error
New Pull Request Checklist
- [x] I am not disclosing a vulnerability.
- [x] I am creating this PR in reference to an issue.
Issue Description
This PR just add 2 jasmine tests to show how the method withinKilometers() can be broken if you add the last parameter (order) with LiveQuery. In fact, when you add the "order" parameter of withinKilometers(), the REST Request will be (and not working) :
verbose: Request: {"op":"subscribe","requestId":1,"query":{"className":"TestObject","where":{"location":{"$geoWithin":{"$centerSphere":[[-30,40],0.0003139224611520954]}}}}}
And if you don't give this parameter, the REST Request will be (and working) :
verbose: Request: {"op":"subscribe","requestId":1,"query":{"className":"TestObject","where":{"location":{"$nearSphere":{"__type":"GeoPoint","latitude":40,"longitude":-30},"$maxDistance":0.0003139224611520954}}}}
Related issue: 7480
Approach
With the Flutter Parse SDK, the whereWithinKilometers() method will generate the REST Request parameter $maxDistanceInKilometers
but the MongoTransform.js doesn't correctly convert to a $maxDistance
parameter.
So LiveQuery with whereWithinMiles(), whereWithinKilometers(), whereWithinRadians() of Flutter SDK not working with LiveQuery.
So i think the problem is on parse-server and not Parse-SDK-Flutter what's why i create my issue here.
TODOs before merging
- [ ] Prevent flutter SDK developper of this issue