In Current Mongo Instance
Following the Mongo Best Practices : Users are created in system database(Admin) rather than respective database and made admin database as authorization database
But creating users in system database (admin) works fine when tested in standalone functions when checked with code(Docker) getting exceptions
Also before creating user used the command
switch to admin
connection string used:
mongodb:// :@xxxxxxx:27017/admin
Exception Received:
Caused by: com.mongodb.MongoCommandException: Command failed with error 263 (OperationNotSupportedInTransaction):
'Cannot run command against the 'admin' database in a transaction.' on server xxxxxxxxxxx.
The full response is {"operationTime": {"$timestamp": {"t": 1649307185, "i": 1}}, "ok": 0.0, "errmsg": "Cannot run command against the 'admin' database in a transaction.",
"code": 263, "codeName": "OperationNotSupportedInTransaction", "$clusterTime": {"clusterTime": {"$timestamp": {"t": 1649307185, "i": 1}},
"signature": {"hash": {"$binary": {"base64": "AAAAAAAAAAAAAAAAAAAAAAAAAAA=", "subType": "00"}}, "keyId": 0}}}