开发者

Does Node.js Mongoose allow you to connect to a database via a user/password?

How can I do that? Right now I can connect to the database, but i开发者_运维技巧t seems like only when no user is set...

http://mongoosejs.com/

It's version 1.0...but I can't find how to enter user/pass into the connection?


var db = mongoose.connect('mongodb://localhost/goaljuice');

mongodb://[username:password@]host1[:port1][,host2[:port2],...[,hostN[:portN]]][/[database][?options]]

http://www.tulek.org/2010/11/28/node-js-mongodb-mongoose/

http://www.mongodb.org/display/DOCS/Connections

In mongodb, you have to assign collections to users before they can access them.

db.addUser("theadmin", "anadminpassword")

http://www.mongodb.org/display/DOCS/Security+and+Authentication

HTH

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜