Error - not authorised on video

I am trying to do the first $match problem and I am getting an error message that says I am not authorised on video execute command.
Any advice please on how to resolve this?
Thanks
Andrew

What command you used to connect to DB? (dbname in connection string)
I think m121 user does not have privileges on video DB

So I am not entirely clear what you are asking but I begin the command as db.movies.aggregate( and so forth

Seems to be working now

For anyone who comes across this & is looking for a solution, I had to exit the mongo shell & relaunch & this error was resolved.

@All

Notice that the correct db for this class is ‘aggregations’ , and the provided Atlas connection string will automatically put you in that db. HTH.

Encountering this problem when running findOne(). I already re-started my mongo shell and reconnect using below string but still saying unauthorized.

mongo “mongodb://cluster0-shard-00-00-jxeqq.mongodb.net:27017,cluster0-shard-00-01-jxeqq.mongodb.net:27017,cluster0-shard-00-02-jxeqq.mongodb.net:27017/aggregations?replicaSet=Cluster0-shard-0” --authenticationDatabase admin --ssl -u m121 -p aggregations --norc

MongoDB Enterprise Cluster0-shard-0:PRIMARY> db.movies.findOne()
2019-06-20T10:37:08.345-0400 E QUERY [js] Error: error: {
“operationTime” : Timestamp(1561041427, 1),
“ok” : 0,
“errmsg” : “not authorized on movies to execute command { find: “movies”, filter: {}, limit: 1.0, singleBatch: true, lsid: { id: UUID(“9b4623b2-6c7e-4c29-96ba-6cb4dc449f78”) }, $clusterTime: { clusterTime: Timestamp(1561041417, 1), signature: { hash: BinData(0, 0F53866AF9BE47C3090389ACA9C65749D7E1749C), keyId: 6661714504839069697 } }, $db: “movies” }”,
“code” : 13,
“codeName” : “Unauthorized”,
“$clusterTime” : {
“clusterTime” : Timestamp(1561041427, 1),
“signature” : {
“hash” : BinData(0,“a75edcUUlGe6wLEzSNWuRPxsf1M=”),
“keyId” : NumberLong(“6661714504839069697”)
}
}
} :
_getErrorWithCode@src/mongo/shell/utils.js:25:13
DBCommandCursor@src/mongo/shell/query.js:708:1
DBQuery.prototype._exec@src/mongo/shell/query.js:113:28
DBQuery.prototype.hasNext@src/mongo/shell/query.js:288:5
DBCollection.prototype.findOne@src/mongo/shell/collection.js:260:10
@(shell):1:1

Most likely you are in wrong DB
Your command is working fine for me
Though your connect string is correct you would have switched DB.That’s why your query is failing
Please run the command db at mongo prompt
You should be in aggregations

You’re correct. I switched to aggregations db and it’s working now. Thanks!