Pergunta

How can I do that? Right now I can connect to the database, but it 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?

Foi útil?

Solução

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

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top