I’ve deployed a MongoDB sharded cluster in MongoDB Atlas dedicated. For some reason i am trying to run db.fsyncLock() from a secondary. But It’s giving me unauthorized error. I also tried many command like findAndModify a collection in config database, but same error. Though I give so many privilege to my user through Atlas UI.
My user has these roles:
authenticatedUserRoles: [
{ role: 'atlasAdmin', db: 'admin' },
{ role: 'backup', db: 'admin' },
{ role: 'clusterMonitor', db: 'admin' },
{ role: 'dbAdminAnyDatabase', db: 'admin' },
{ role: 'enableSharding', db: 'admin' },
{ role: 'readWriteAnyDatabase', db: 'admin' }
]
I am getting this error:
MongoServerError[Unauthorized]: not authorized on admin to execute command { fsync: 1, lock: true, lsid: { id: UUID(“3c98878b-9c36-4a5a-945f-f844bda6c04f”) }, $clusterTime: { clusterTime: Timestamp(1726470174, 1), signature: { hash: BinData(0, D048A6DCF75FA7B59DB4AE831656E536D1ED989A), keyId: 7415097913686097942 } }, $readPreference: { mode: “primaryPreferred” }, $db: “admin” }
Is there any to run these kind of command from Atlas managed MongoDB cluster?