Page 1 of 1

Geospatial Queries problem

Posted: Thu Jan 16, 2014 5:24 pm
by Tom6106181

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


Geospatial Queries problem

Posted: Thu Jan 16, 2014 5:39 pm
by Kateryna Grynko

Hi Tom,

Please post a screenshot of your database collection structure.


Geospatial Queries problem

Posted: Thu Jan 16, 2014 5:41 pm
by Tom6106181

Geospatial Queries problem

Posted: Thu Jan 16, 2014 5:45 pm
by Tom6106181

query service:
Image


Geospatial Queries problem

Posted: Thu Jan 16, 2014 7:25 pm
by Kateryna Grynko

Tom,

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


Geospatial Queries problem

Posted: Thu Jan 16, 2014 7:29 pm
by Tom6106181

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!


Geospatial Queries problem

Posted: Thu Jan 16, 2014 9:16 pm
by Kateryna Grynko

Tom,

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


Geospatial Queries problem

Posted: Tue Jan 21, 2014 6:19 pm
by Tom6106181

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


Geospatial Queries problem

Posted: Tue Jan 21, 2014 6:35 pm
by Kateryna Grynko

Hi Tom,

Thank you for this update!


Geospatial Queries problem

Posted: Tue Jan 21, 2014 6:37 pm
by Tom6106181

No problem!