Tom6106181
Posts: 0
Joined: Fri Aug 02, 2013 12:39 pm

Geospatial Queries problem

Hi.
Following the docs;
http://docs.appery.io/documentation/b...

I have tested the query - where - id: someid and so on, no problem there, but the nearsphere is not working at all.

I am trying to retrieve locations based on geopoints. However, I only get "index error", when I Test the query service.

DB COL = location:
codelocation
(geopoint),idx/code

Where:
code{ "location" : { "$nearSphere" : [16.373, 48.208], "$maxDistanceInKilometers" : 550 } }/code

Error msg:
code{
"status":"500 Internal Server Error",
"url":"https://api.appery.io/rest/1/db/collections/events",
"response":{
"code":"DBSQ000",
"description":"can't find any special indices: 2d (needs index), 2dsphere (needs index), for: { location: { $nearSphere: [ 16.373, 48.208 ], $maxDistance: 0.08632867681682624 }, $and: [ { $or: [ { acl: null }, { acl.*.read: true } ] } ] }"
}
}/code

After some googling, I found that there might be an index problem on the col "location" in DB. Could some of the support staff test out the approach from docs and make modifications if they are wrong!?!?!

Please help, thanks!

-Tom

Kateryna Grynko
Posts: 0
Joined: Thu Nov 15, 2012 9:13 am

Geospatial Queries problem

Hi Tom,

Please post a screenshot of your database collection structure.

Tom6106181
Posts: 0
Joined: Fri Aug 02, 2013 12:39 pm

Geospatial Queries problem

Tom6106181
Posts: 0
Joined: Fri Aug 02, 2013 12:39 pm

Geospatial Queries problem

query service:
Image

Kateryna Grynko
Posts: 0
Joined: Thu Nov 15, 2012 9:13 am

Geospatial Queries problem

Tom,

Take a look at here please:
https://getsatisfaction.com/apperyio/...

Tom6106181
Posts: 0
Joined: Fri Aug 02, 2013 12:39 pm

Geospatial Queries problem

So if I understand you correct, your DB service do not support querying collection for items - where location is - example 200km away from device ???

And WHY do your docs display that this is actually a feature?

EDIT:
Please have MAX provide a response to this question!

Kateryna Grynko
Posts: 0
Joined: Thu Nov 15, 2012 9:13 am

Geospatial Queries problem

Tom,

Please share your app with a href="mailto:support@appery.io" rel="nofollow"support@appery.io/a and we'll take a look.

Tom6106181
Posts: 0
Joined: Fri Aug 02, 2013 12:39 pm

Geospatial Queries problem

After ALOT of headtwisting and trial and error.. I finally figured out the problem (I think), and I want to let u know.

I re-built the collection, 1 col at a time. I tested, and it was working, I added more colums, I tested again. Same index error. and thats how I spent my monday :)

So today.. after some more twisting and turning, I tried to re-name the column to "loc" (just to have a go), suddenly everything was working as expected. Then, I renamed to location again, everything still working. Then, cleared the collection, added a row, Error again.

So now, I renamed to loc, and back to location, tested several times, everything is working.

So I guess, there is something wrong with building indexes after some "manual" editing of collection rows. Now I have not done a single change manual, only with services, and everything works as expected. However, if I mess around with manual editing/clearing of all rows, back to index error. New rename, and back to location = everything all good again.

So now you know :)

-Tom

Kateryna Grynko
Posts: 0
Joined: Thu Nov 15, 2012 9:13 am

Geospatial Queries problem

Hi Tom,

Thank you for this update!

Tom6106181
Posts: 0
Joined: Fri Aug 02, 2013 12:39 pm

Geospatial Queries problem

No problem!

Return to “Issues”