Connecting to Your Sandbox Cluster from the mongo Shell

While connecting to the cluster I am getting the following error:-

MongoDB shell version v4.0.4
connecting to: mongodb://sandbox-shard-00-00-24aco.mongodb.net:27017,sandbox-shard-00-01-24aco.mongodb.net:27017,sandbox-shard-00-02-24aco.mongodb.net:27017/test?replicaSet=SandBox-shard-0
2018-11-10T10:37:12.235+0530 I NETWORK [js] Starting new replica set monitor for SandBox-shard-0/sandbox-shard-00-00-24aco.mongodb.net:27017,sandbox-shard-00-01-24aco.mongodb.net:27017,sandbox-shard-00-02-24aco.mongodb.net:27017
2018-11-10T10:37:12.696+0530 I NETWORK [js] Successfully connected to sandbox-shard-00-01-24aco.mongodb.net:27017 (1 connections now open to sandbox-shard-00-01-24aco.mongodb.net:27017 with a 5 second timeout)
2018-11-10T10:37:12.962+0530 I NETWORK [js] Successfully connected to sandbox-shard-00-02-24aco.mongodb.net:27017 (1 connections now open to sandbox-shard-00-02-24aco.mongodb.net:27017 with a 5 second timeout)
2018-11-10T10:37:13.269+0530 I NETWORK [ReplicaSetMonitor-TaskExecutor] Successfully connected to sandbox-shard-00-00-24aco.mongodb.net:27017 (1 connections now open to sandbox-shard-00-00-24aco.mongodb.net:27017 with a 5 second timeout)
Implicit session: session { “id” : UUID(“f1104bd2-455d-471a-a42a-3aafc69bf830”) }
MongoDB server version: 3.6.8
WARNING: shell and server versions do not match
Error while trying to show server startup warnings: user is not allowed to do action [getLog] on [admin.]

Please explain this error.

The account you made does not have the required access rights. What roles did you assign the account?

I’m facing the same error as well. My MongoDB shell version is v4.1.5 and server version is 4.0.4

MongoDB server version: 4.0.4
WARNING: shell and server versions do not match
Error while trying to show server startup warnings: user is not allowed to do action [getLog] on [admin.]

The user m001-student has both read and write access as described in the lecture. The show dbs command is not working. Please help.

The user has read and write permission.

On what exactly? :slight_smile:

Because the error very specifically tells you that the user cannot access one particular DB.

Mind you… if you specifically connect to the DB you made for that user, you should have less problems.

I am facing the same issue,
What is solution for this ?

I have the same issue

if we have an older version of the shell - say 3.6.4 - should we upgrade to what ever Shell Atlas is using ?4.0.4 ? will we be able to carry out the rest of the labs with an older shell version ?

also i ensured the user had full write permission so no sure what this error means
WARNING: shell and server versions do not match

Error while trying to show server startup warnings: user is not allowed to do action [getLog] on [admin.]

My previous question still stands: you gave the user R/W on what specifically? Which roles did you give them, on which databases? Also, what is the connection string you’re using?

Think about what you are asking the user to do and whether that makes sense.

I gave readwrite privileges to my user on admin database which which implies to all the collections in it.
and am using Standard connection string (shell 3.4+)

I mean, can you please show us the actual connection command you’re using?

The reason why I ask is because the user we’re creating for our private clusters would usually get dbAdmin on its own separate database (not on “admin”) and the “admin” database will only be used for authentication purposes.

m1 m2

User Privileges - Read and write to any database

1 Like

ACK, that would/should suffice, yes.

Have you specified source IP rules that could block access?

m3

This?

Choosing access from any ip address included my ip address too, is this you were asking about?

Right, all of this looks fine. And you’re saying that the account still cannot be used to connect to the database?

EDIT:
Right, this is very odd, but if you give the user account “AtlasAdmin” rights, then it can connect without troubles.

I still need to figure out why this is needed. You’d expect R/W to be enough.

This is when given “Atlas admin” privileges,
at the end it opens "MongoDB Enterprise Sandbox-shard-0:PRIMARY> ",
is that correct?
or should it be just “Sandbox-shard-0:PRIMARY>” ?

This is when given “Read and write to any database” privileges,
at the end it opens "MongoDB Enterprise Sandbox-shard-0:PRIMARY> "
but showing an error on top.

Shall I continue giving “Atlas admin” privileges ?
is that the final solution?

Please help me.
dead line is within a day.

Yeah, for now that will at least get it to work for you.

I’ll take a look why it won’t work without this at a later point.

I’m back! With good news!

Would you believe that the error in question is not a blocking issue?

For example, on my Atlast cluster I have made:

  • A test user named “TestUser”
  • A test database called “LetsGo”
  • A test collection named “NiceCollection”.
  • The user “TestUser” has role “dbAdmin” on “LetsGo” and nothing else at all.

I then log in using the following:

mongo "mongodb://MYCLUSTER-shard-00-00-u3isl.mongodb.net:27017,MYCLUSTER-shard-00-01-u3isl.mongodb.net:27017,MYCLUSTER-shard-00-02-u3isl.mongodb.net:27017/LetsGo?replicaSet=MYCLUSTER-shard-0" --ssl --authenticationDatabase admin --username TestUser --password

This gives the following results:

  • Yes, it gives the result that the user cannot read [getLog] on “admin”.
  • Yes, the user cannot show any databases.
  • But the user can also work perfectly with its own database!

So the error is NOT blocking.