How to execute runCommand with Mongoose?

前端 未结 4 489
一生所求
一生所求 2021-02-07 13:28

I am using Node.js and Mongoose to access my MongoDB. I am using a model that stores some geo coordinates. I have them indexed and everything seems to work as expected. What I a

4条回答
  •  温柔的废话
    2021-02-07 13:59

    YourModel.db.db.executeDbCommand({geoNear : "locations", near : [11.252,14.141], spherical: true }, function(err,res) { console.log(res.documents[0].results)});
    

    node 0.6.6, mongoose@2.4.9, mongodb version v2.0.2

    its a bit hacky and could change.

提交回复
热议问题