Page 2 of 2

Geospatial queries with parameters returning entire collection

Posted: Thu Jul 13, 2017 5:36 am
by Bruce Stuart

{ "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


Geospatial queries with parameters returning entire collection

Posted: Thu Jul 13, 2017 12:14 pm
by Josette

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


Geospatial queries with parameters returning entire collection

Posted: Fri Jul 14, 2017 12:43 am
by Josette

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.