Connect to Sandbox

My connection string looks nothing like what is shown in the video. I get a prompt for password, but cannot enter it.

mongo “mongodb+srv://dhsandbox-fveam.mongodb.net/test” --username m001-student

Why you are unable to enter password?What do you mean by cannot enter
Simply type the password or you can pass the password on command line itself
When you type password it wont show anything on screen
I tried your command

C:\Users>mongo “mongodb+srv://dhsandbox-fveam.mongodb.net/test” --username m001-student
MongoDB shell version v4.0.5
Enter password: ---------------------->enter your password
connecting to: mongodb://dhsandbox-shard-00-00-fveam.mongodb.net.:27017,dhsandbox-shard-00-01-fveam.mongodb.net.:27017,dhsandbox-shard-00-02-fveam.mongodb.net.:27017/test?authSource=admin&gssapiServiceName=mongodb&replicaSet=DHSandbox-shard-0&ssl=true

2019-03-25T08:14:03.933+0530 E QUERY [js] Error: can’t authenticate against replica set node dhsandbox-shard-00-01-fveam.mongodb.net:27017 :: caused by :: can’t connect to new replica set master [dhsandbox-shard-00-01-fveam.mongodb.net:27017], err: Location8000: bad auth Authentication failed. :
connect@src/mongo/shell/mongo.js:328:13
@(connect):1:6
exception: connect failed

It failed in 1st attempt due to authentication
Used below command and able to connect

C:\Users>mongo “mongodb+srv://dhsandbox-fveam.mongodb.net/test” --authenticationDatabase admin --ssl --username m001-student
MongoDB shell version v4.0.5
Enter password:
connecting to: mongodb://dhsandbox-shard-00-00-fveam.mongodb.net.:27017,dhsandbox-shard-00-01-fveam.mongodb.net.:27017,dhsandbox-shard-00-02-fveam.mongodb.net.:27017/test?authSource=admin&gssapiServiceName=mongodb&replicaSet=DHSandbox-shard-0&ssl=true

Implicit session: session { “id” : UUID(“f79cccba-3c8b-4533-a04a-06798961d333”) }
MongoDB server version: 4.0.6
Error while trying to show server startup warnings: user is not allowed to do action [getLog] on [admin.]
MongoDB Enterprise DHSandbox-shard-0:PRIMARY> db
test
MongoDB Enterprise DHSandbox-shard-0:PRIMARY> show dbs
admin 0.000GB
local 0.881GB
MongoDB Enterprise DHSandbox-shard-0:PRIMARY>

or you can use

mongo “mongodb+srv://dhsandbox-fveam.mongodb.net/test” --authenticationDatabase admin --ssl --username m001-student --password “your password”

I could not type it in. I added it to the command.

This is the error I get now “Error while trying to show server startup warnings: user is not allowed to do action [getLog] on [admin.]”

This is my connection string: mongo "mongodb+srv://sandbox-trhdn.mongodb.net:27017/test" --username m001-student --password m001-mongodb-basics

Even i got that.Please ignore it
Did you get connected to mongo or not as below?

MongoDB Enterprise DHSandbox-shard-0:PRIMARY>

No, I got MongoDB Enterprise Sandbox-shard-0:PRIMARY>

Hi @debra_27516

Can I double check that you have setup your admin user per the steps in “Chapter 1: The Mongod ### Lab - Launching Mongod” ?

Hope this helps,
Eoin

How do I backtrack to ch1? I only see ch2 now.

Hi @debra_27516

There are some prerequisite steps needed in Chapter 1 to ensure the configuration is setup correctly and it’s important to understand if the environment is configured. In this case, I’d like to ensure that user is configured as there are errors related to authentication in your earlier comments.

Hope this clarifies why this is required and how it will help in resolving your issue.

Kindest regards,
Eoin

I did all the labs for Chapter 1. I did not encounter any errors.

I am still stuck. This is the connection string I get from Atlas:
mongo "mongodb+srv://sandbox-trhdn.mongodb.net/test" --username m001-student
It does not work unless I modify it to mongo "mongodb+srv://sandbox-trhdn.mongodb.net:27017/test" --username m001-student --password m001-mongodb-basics I cannot manually enter my password at the command prompt

My insertOne cmd results in successful, but the records added do not show in my video
.
moviesScratch in Compass

What am I doing wrong?

Hi debra_27516,

This is just a warning message telling you that user is not allowed to do action [getLog] on admin database.

Can you please share the insert query you used and on which database. Make sure you change the database before running insert query. Please share the screenshots as well.

Kanika