thisissami
thisissami

Reputation: 16383

GeoSpatial indexing in node-mongodb-native or mongoose?

I'm currently building a webserver in nodeJS that'll be using mongoDB. One of the main reasons that I picked mongoDB over other databases is that it features geospatial indexing that's integral to my app. That said, I can't seem to find any information on how to do this using any of the node drivers. I've found questions on google groups where people have asked what they're doing wrong with their geospatial indexing code, so I'm assuming that it's possible, but I just can't find any information on it anywhere. I've looked through the node-mongodb-native source code, but I wasn't able to find anything there (though I easily could have skipped it or just not known what to look for exactly).

Does anybody have any idea how to run these commands in nodeJS? http://www.mongodb.org/display/DOCS/Geospatial+Indexing Alternatively if anybody knows where in the node-mongodb-native source code these commands exist, that would also be awesome.

Best and thanks,
Sami

Upvotes: 3

Views: 1022

Answers (1)

rafalio
rafalio

Reputation: 3946

I think you can just pass an array with options, say to the find command, as outlined here.

So taking one example from the MongoDB site, you could just pass this type of object into the find() function

{ "location" : { "$near" : [50,50] }, "category" : "coffee" }

Upvotes: 1

Related Questions