Database permissions broken?

Hello!

I was studying for this course last saturday and everything was fine. Nevertheless, I’ve been having troubles to call any function since yesterday (sunday).

As stated in the introductory chapter I’m connecting to the databes by explicitly stating all the servers shards:

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

which initially worked. Now I can correctly connect to the cluster, I can call show dbs/collections, use collection but nothing else.
This is an example:

MongoDB Enterprise Cluster0-shard-0:PRIMARY> db.movies.findOne()
uncaught exception: Error: error: {
	"operationTime" : Timestamp(1601298150, 26),
	"ok" : 0,
	"errmsg" : "not authorized on video to execute command { find: \"movies\", filter: {}, limit: 1.0, singleBatch: true, lsid: { id: UUID(\"cec347cd-f5b5-4dde-a8dc-5d1458ead93f\") }, $clusterTime: { clusterTime: Timestamp(1601296725, 1), signature: { hash: BinData(0, E5DEAF18BAB17234929308FCD0713FB18F35D84B), keyId: 6829321948548300802 } }, $db: \"video\" }",
	"code" : 13,
	"codeName" : "Unauthorized",
	"$clusterTime" : {
		"clusterTime" : Timestamp(1601298150, 26),
		"signature" : {
			"hash" : BinData(0,"JrVmxn9+wru7YdAd6wQPJ3w3ITo="),
			"keyId" : NumberLong("6829321948548300802")
		}
	}
} :
_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

Any idea about the reason?

Most likely you switched to a different databases. Please post screenshot of the command

db

1 Like

Oh yes, damn. I thought that I had to switch to video that also contained movies collection (in M001 I had to do so as far as I remember). My bad.

1 Like