My API code is using the latest Mongoose 5.0.11 with the proper Mongo 3.4 connection string to connect to the free Atlas service.
mongodb://someadmin:<PASSWORD>@ascatlas-shard-00-00-6fake.mongodb.net:27017,ascatlas-shard-00-01-6fake.mongodb.net:27017,ascatlas-shard-00-02-6fake.mongodb.net:27017/DB?ssl=true&replicaSet=ascatlas-shard-0&authSource=admin
When it does this, the initial connection works properly, but then errors out with a permissions problem being unable to list the indexes on the collection in the "DB database". The user credentials I'm connecting with is the Atlas Admin, so not sure what other permissions I can provide. Any ideas?
profile:mongoose MongoDB connection established +5s
profile:mongoose profiles ensureIndex { identityID: 1 } { unique: 1, background: true } +5ms
/API-User/node_modules/mongoose/lib/utils.js:423
throw err;
^
MongoError: user is not allowed to do action [listIndexes] on [DB.$cmd]
at queryCallback (/API-User/node_modules/mongodb-core/lib/cursor.js:223:25)
at /API-User/node_modules/mongodb-core/lib/connection/pool.js:541:18
at _combinedTickCallback (internal/process/next_tick.js:131:7)
at process._tickCallback (internal/process/next_tick.js:180:9)
Seems that the user has no permission to listIndexes As per the documentation
Required Access The user executing the command requires either find privileges on the system.indexes collection or the listIndexes privilege action. At a minimum, the read built-in role provide the requisite permissions.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With