MongoDB query against geospatial index with maxDistance fails from node.js client
- by user1735497
I want to query against a geospatial index in mongo-db (designed after this tutorial http://www.mongodb.org/display/DOCS/Geospatial+Indexing).
So when I execute this from the shell everything works fine:
db.sellingpoints.find(( { location : { $near: [48.190120, 16.270895], $maxDistance: 7 / 111.2 } } );
but the same query from my nodejs application (using mongoskin or mongoose), won't return any results until i set the distance-value to a very high number (5690)
db.collection('sellingpoints')
.find({ location: { $near: [lat,lng], $maxDistance: distance / 111.2} })
.limit(limit)
.toArray(callback);
Has someone any idea how to fix that?