Unauthorized to Run Queries on movies collection

Cannot run queries on movies collection.
The error in detail is the following:
MongoDB Enterprise Cluster0-shard-0:PRIMARY> db.movies.findOne()
uncaught exception: Error: error: {
“operationTime” : Timestamp(1606079995, 1),
“ok” : 0,
“errmsg” : “not authorized on video to execute command { find: “movies”, filter: {}, limit: 1.0, singleBatch: true, lsid: { id: UUID(“f64a20c4-2cdf-43ae-b7c2-8ab3c676e08d”) }, $clusterTime: { clusterTime: Timestamp(1606079985, 1), signature: { hash: BinData(0, 9BAD7AA6A1FACB26E36B8F673CA12B3F993766BF), keyId: 6863706941324001282 } }, $db: “video” }”,
“code” : 13,
“codeName” : “Unauthorized”,
“$clusterTime” : {
“clusterTime” : Timestamp(1606079995, 1),
“signature” : {
“hash” : BinData(0,“cPc5ff+QmytHezcJXtxC++Y5J2c=”),
“keyId” : NumberLong(“6863706941324001282”)
}
}
} :
_getErrorWithCode@src/mongo/shell/utils.js:25:13
DBCommandCursor@src/mongo/shell/query.js:703:15
DBQuery.prototype._exec@src/mongo/shell/query.js:112:28
DBQuery.prototype.hasNext@src/mongo/shell/query.js:287:5
DBCollection.prototype.findOne@src/mongo/shell/collection.js:260:10
@(shell):1:1

You may be connected to wrong DB
db commadn will show to which DB you are connected
m121 user does not have access to video DB.Hence the not authorized error
You should connect to aggregations DB
Switch to aggregations DB by below command
use aggregations

1 Like