Could not access cluster: not authorized on video to execute command

Successfully logged in the replica set using give command:

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

But, I could not access the collections. I get not authorized on video to execute command error

MongoDB Enterprise Cluster0-shard-0:PRIMARY>
MongoDB Enterprise Cluster0-shard-0:PRIMARY> show dbs
100YWeatherSmall 0.128GB
admin 0.000GB
aggregations 0.067GB
citibike 0.367GB
city 0.002GB
config 0.016GB
coursera-agg 0.083GB
local 0.940GB
mflix 0.449GB
results 0.000GB
ships 0.001GB
video 0.513GB
MongoDB Enterprise Cluster0-shard-0:PRIMARY> use video
switched to db video
MongoDB Enterprise Cluster0-shard-0:PRIMARY> show collections
2020-02-24T15:38:28.801+0000 E QUERY [thread1] Error: listCollections failed: {
“operationTime” : Timestamp(1582558703, 1),
“ok” : 0,
“errmsg” : “not authorized on video to execute command { listCollections: 1.0, filter: {}, lsid: { id: UUID(“96b18a9b-917a-4ff8-b456-b0106f62afe5”) }, $clusterTime: { clusterTime: Timestamp(1582558703, 1), signature: { hash: BinData(0, 3A123589A42CBD71F3403892289A433234486064), keyId: 6763648209215553537 } }, $db: “video” }”,
“code” : 13,
“codeName” : “Unauthorized”,
“$clusterTime” : {
“clusterTime” : Timestamp(1582558703, 1),
“signature” : {
“hash” : BinData(0,“OhI1iaQsvXHzQDiSKJpDMjRIYGQ=”),
“keyId” : NumberLong(“6763648209215553537”)
}
}
} :
_getErrorWithCode@src/mongo/shell/utils.js:25:13
DB.prototype._getCollectionInfosCommand@src/mongo/shell/db.js:941:1
DB.prototype.getCollectionInfos@src/mongo/shell/db.js:953:19
DB.prototype.getCollectionNames@src/mongo/shell/db.js:964:16
shellHelper.show@src/mongo/shell/utils.js:853:9
shellHelper@src/mongo/shell/utils.js:750:15
@(shellhelp2):1:1
MongoDB Enterprise Cluster0-shard-0:PRIMARY>

MongoDB Enterprise Cluster0-shard-0:PRIMARY>
MongoDB Enterprise Cluster0-shard-0:PRIMARY> db.products.find().pretty()
Error: error: {
“operationTime” : Timestamp(1582558773, 1),
“ok” : 0,
“errmsg” : “not authorized on video to execute command { find: “products”, filter: {}, lsid: { id: UUID(“96b18a9b-917a-4ff8-b456-b0106f62afe5”) }, $clusterTime: { clusterTime: Timestamp(1582558703, 1), signature: { hash: BinData(0, 3A123589A42CBD71F3403892289A433234486064), keyId: 6763648209215553537 } }, $db: “video” }”,
“code” : 13,
“codeName” : “Unauthorized”,
“$clusterTime” : {
“clusterTime” : Timestamp(1582558773, 1),
“signature” : {
“hash” : BinData(0,“Mp8h1u9ZUXU8FNM1rr71yIZCBm0=”),
“keyId” : NumberLong(“6763648209215553537”)
}
}
}
MongoDB Enterprise Cluster0-shard-0:PRIMARY>

1 Like

use aggregations

The aggregations db is all you need for this course. All other dbs are not accessible.

2 Likes

Sorry for the silly mistake. Thank you.