开发者

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 ea开发者_StackOverflowsily 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


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" }
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜