parse-server icon indicating copy to clipboard operation
parse-server copied to clipboard

Issuse with quering geopoints in parse-server

Open ldmtam opened this issue 10 years ago • 5 comments

For implementation related questions or technical support, please refer to the Stack Overflow and Server Fault communities.

Make sure these boxes are checked before submitting your issue -- thanks for reporting issues back to Parse Server!

Environment Setup

Localhost with nodejs v4.4.1, mongdb v3.2, parse-server v2.2.2

Steps to reproduce

Logs/Trace

This is my query to get 3 nearest point untitled

But when i excute it, the console show that had some errors with mongdb: 2

Please help me fix it, thanks.

ldmtam avatar Mar 29 '16 10:03 ldmtam

Looking at the screenshot it seems that the root cause is

unable to find index for $geoNear query

Have you tried adding an index manually?

codebreach avatar Mar 29 '16 11:03 codebreach

Thanks @codebreach, it works well now but when i try the same query with Rest API, parse-server always return all the geo objects although i have set the limit = 1. Please help me. 3 4 5

ldmtam avatar Mar 29 '16 12:03 ldmtam

@ldmtam that seems like an issue with the query code itself. Someone who is owner of the project can probably answer this better.

codebreach avatar Mar 29 '16 18:03 codebreach

This is a duplicate of #999, so I'm going to close this. We haven't been able to reproduce this issue yet, if you could provide a snippet of code that reliably reproduces this issue, and post it in #999, we'll be able to help.

drew-gross avatar Mar 31 '16 03:03 drew-gross

Haven't had time to write a test case, but I have investigated this issue and can confirm that it occurs when using an $or query that is composed of two queries with separate "geoPoint" objects. When I do the same query with the usual parse server (api.parse.com) it does not fail. When I use my new parse-server with an $or query that is composed of one internal query with a geoPoint (nearSphere) object it works. Adding the second query with geoPoint makes it fail. Again, doing the $or with both geoPoint queries inside the $or works when using api.parse.com and not when using parse-server.

msniff16 avatar Apr 01 '16 17:04 msniff16