How to connect with username/password to mongodb using native node.js driver

后端 未结 1 466
梦如初夏
梦如初夏 2021-02-13 06:53

I\'m using native mongo driver in Joyent cloud, the node.js application runs fine locally but in Joyent when i run with usrname/pswd that they provided it fails to connect. foll

1条回答
  •  夕颜
    夕颜 (楼主)
    2021-02-13 07:55

    Easier if you just use MongoClient

    MongoClient.connect('mongodb://admin:password@localhost:27017/db', function (err, db) {
    

    0 讨论(0)
提交回复
热议问题