Bruce Stuart
Posts: 0
Joined: Fri Oct 24, 2014 4:42 am

Geospatial queries with parameters returning entire collection

{ "gCenterGeo" : { "$nearSphere" : [-111.6266316,33.232841] , "$maxDistanceInMiles" : 25} }

Here's an equivalent query I make against a database in our Application - the code is extracted from our console (where we log it prior to going to the DB - so I'm sure it works on the front end) - and we are making that call / similar ones throughout our app.

Below is my execution against our Db --- any differences that you can see ?

Image

Josette
Posts: 0
Joined: Mon Jun 08, 2015 10:59 pm

Geospatial queries with parameters returning entire collection

My table has pointer columns and the geopoint column is the last column of the table. These may be issues.

Josette
Posts: 0
Joined: Mon Jun 08, 2015 10:59 pm

Geospatial queries with parameters returning entire collection

I solved the problem. I had to make the geopoint column the first column in the collection. I used the google lat/lng geopoints in the query and column and got the correct results. I hope this helps someone.

Return to “Issues”