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

后端 未结 1 1760
一个人的身影
一个人的身影 2021-02-13 07:03

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:48

    Easier if you just use MongoClient

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

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