Not authorized on x to execute command y

Context: I am using Windows.

I connect using: 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

I get the following warning: MongoDB server version: 4.2.12 WARNING: shell and server versions do not match

At this point I can see the databases and collections with show dbs and show collections.

But when I try excute any query/ aggregation on any collection, I get an error message that says I am Unauthorized to do so.

For instance. The following command: db.movies.find() on the mflix db returns the errmsg not authorized on mflix to execute command....

Is there a step I am missing when connecting to the cluster that would cause these errors to occur?

The user m121 is only allowed to use the aggregations database.

2 Likes