Open kasir-barati opened 3 years ago
Whats your mongo version?
I suspect the error is caused by: https://github.com/leonardodalcin/mongo-auto-erd/blob/master/source/mongo/mapReduceCollectionProperties.ts#L12.
Probably the mapReduce
method is not supported anymore.
Run into the same error. The same uri string worked w/ mongo cli client & mongo-express. So I'm sure the authentication worked actually. The user is an admin and have full previlige over this database. Thus I suspect it's the same error as mentioned above due ot mapReduce
.
Mongo: 6.0.1 bitnami docker image
- Connecting to databaseMongoError: not authorized on test_database to execute command { mapReduce: "system.profile", map: "function () {
// @ts-ignore
// tslint:disable-next-line
for (let key in this) {
// @ts-ignore
emit(key...", reduce: "function (key, values) {
let result = [];
if (Array.isArray(values)) {
result = values;
}
else {
...", out: { inline: 1 }, limit: 50, lsid: { id: UUID("5f663ef8-9ddf-442e-9552-0798c9549a53") }, $db: "test_database" }
at MessageStream.messageHandler (/home/fengxia/.npm/_npx/a3e7fde68de1b4c3/node_modules/mongodb/lib/cmap/connection.js:299:20)
at MessageStream.emit (events.js:400:28)
at processIncomingData (/home/fengxia/.npm/_npx/a3e7fde68de1b4c3/node_modules/mongodb/lib/cmap/message_stream.js:144:12)
at MessageStream._write (/home/fengxia/.npm/_npx/a3e7fde68de1b4c3/node_modules/mongodb/lib/cmap/message_stream.js:42:5)
at writeOrBuffer (internal/streams/writable.js:358:12)
at MessageStream.Writable.write (internal/streams/writable.js:303:10)
at Socket.ondata (internal/streams/readable.js:731:22)
at Socket.emit (events.js:400:28)
at addChunk (internal/streams/readable.js:293:12)
at readableAddChunk (internal/streams/readable.js:267:9)
at Socket.Readable.push (internal/streams/readable.js:206:10)
at TCP.onStreamRead (internal/stream_base_commons.js:188:23) {
ok: 0,
code: 13,
codeName: 'Unauthorized'
}
What id did
npm i -D mongo-auto-erd
"erd": "mongo-erd --db dbname --outfile ./erd --uri mongodb+srv://user:pass@atlas.mongo.net/dbname?authSource=admin&replicaSetatlas-xyz&readPreference=primary&ssl=true"
error message
Database is on atlas Node version: 14.17.4 OS: ubuntu 20.04
Do you have any idea?