Fix nearSphere queries when sorting by another key on Postgres#6026
Fix nearSphere queries when sorting by another key on Postgres#6026jaypatel24 wants to merge 1 commit intoparse-community:masterfrom
Conversation
|
You can pass in a sorted parameter false. parse-community/Parse-SDK-JS#582
|
|
Ah... I need to investigate further but it seems like the PostgresStorageAdapter might be ignoring that parameter, since it always adds the sort? If that's true, should we update it to only add the sort if However, looking at these tests, it doesn't seem like |
|
https://github.com/parse-community/Parse-SDK-JS/blob/master/src/ParseQuery.js#L1304 We try to make Mongo and Postgres to have similar functionality. https://docs.mongodb.com/manual/reference/operator/query/nearSphere/#sort-operation If we merge your PR the following will happen. Mongo will sort by default If sort is false, we use $centersphere which doesn't sort that way both db will have same functionality. |
|
That makes sense, I think we can close this! |
Currently the Postgres adapter always adds a sort on a GeoPoint field if doing a nearSphere query, which isn't the expected behavior.
Previously the added test case was passing for Mongo but failing for Postgres, but now it passes for both.