Answer the question
In order to leave comments, you need to log in
Why can't I access the db in mongoose?
Connected via shell to mogno, created a database with the use hotel command, then created a user
db.createUser({
user: "name",
pwd: "password",
roles: [{ role: "userAdmin", db: "hotel" }],
});
mongodb://name:[email protected]:port/hotel?authMechanism=SCRAM-SHA-1
MongoServerError: not authorized on hotel to execute command { insert: "hotels", documents: [ JSON ], ordered: true, lsid: { id: UUID("330df08b-c0d6-4900-9015-ce5da07d0bc1") }, $db: "hotel" },
//тут очень много строк я их вырезал
at addChunk (node:internal/streams/readable:315:12) {
ok: 0,
code: 13,
codeName: 'Unauthorized'
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question