我怎样才能做到这一点?现在,我可以连接到数据库,但是似乎只有设置没有用户...

http://mongoosejs.com/

它是1.0版...但是我找不到如何将用户/传递到连接中?

有帮助吗?

解决方案

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

在MongoDB中,您必须将收款分配给用户才能访问它们。

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

http://www.mongodb.org/display/docs/security+ and+authentication

Hth

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top