0

hello can anybody help me with this error

$ mongo "mongodb+srv://cluster0-zdzwa.mongodb.net/test"  --username admin-dalia
MongoDB shell version v4.2.6
Enter password: Cannot get console mode 6
connecting to: mongodb://cluster0-shard-00-02-zdzwa.mongodb.net:27017,cluster0-shard-00-00-zdzwa.mongodb.net:27017,cluster0-shard-00-01-zdzwa.mongodb.net:27017/test?authSource=admin&compressors=disabled&gssapiServiceName=mongodb&replicaSet=Cluster0-shard-0&ssl=true
2020-05-01T18:00:58.985+0300 I  NETWORK  [js] Starting new replica set monitor for Cluster0-shard-0/cluster0-shard-00-02-zdzwa.mongodb.net:27017,cluster0-shard-00-00-zdzwa.mongodb.net:27017,cluster0-shard-00-01-zdzwa.mongodb.net:27017
2020-05-01T18:00:58.986+0300 I  CONNPOOL [ReplicaSetMonitor-TaskExecutor] Connecting to cluster0-shard-00-02-zdzwa.mongodb.net:27017
2020-05-01T18:00:58.986+0300 I  CONNPOOL [ReplicaSetMonitor-TaskExecutor] Connecting to cluster0-shard-00-01-zdzwa.mongodb.net:27017
2020-05-01T18:00:58.986+0300 I  CONNPOOL [ReplicaSetMonitor-TaskExecutor] Connecting to cluster0-shard-00-00-zdzwa.mongodb.net:27017
2020-05-01T18:00:59.983+0300 I  NETWORK  [ReplicaSetMonitor-TaskExecutor] Confirmed replica set for Cluster0-shard-0 is Cluster0-shard-0/cluster0-shard-00-00-zdzwa.mongodb.net:27017,cluster0-shard-00-01-zdzwa.mongodb.net:27017,cluster0-shard-00-02-zdzwa.mongodb.net:27017
2020-05-01T18:01:00.530+0300 I  NETWORK  [js] Marking host cluster0-shard-00-01-zdzwa.mongodb.net:27017 as failed :: caused by :: Location40659: can't connect to new replica set master [cluster0-shard-00-01-zdzwa.mongodb.net:27017], err: AuthenticationFailed: Missing expected field "pwd"

It looks like this is a MongoDB Atlas cluster. Please ensure that your IP whitelist allows connections from your network.

2020-05-01T18:01:00.530+0300 E  QUERY    [js] Error: can't connect to new replica set master [cluster0-shard-00-01-zdzwa.mongodb.net:27017], err: AuthenticationFailed: Missing expected field "pwd" :
connect@src/mongo/shell/mongo.js:341:17
@(connect):2:6


----------


2020-05-01T18:01:00.533+0300 F  -        [main] exception: connect failed
2020-05-01T18:01:00.533+0300 E  -        [main] exiting with code 1

thanks in advance

2 Answers 2

1

You need to add your IP to whitelist. In your mongoAtlas there is a tab securicy -> network access -> add there 0.0.0.0 This will allow access from any IP from web.

Sign up to request clarification or add additional context in comments.

1 Comment

1

If you look at the error it looks like you didn't or can't enter your password.

$ mongo "mongodb+srv://cluster0-zdzwa.mongodb.net/test"  --username admin-dalia
MongoDB shell version v4.2.6
Enter password: Cannot get console mode 6

The error from Atlas is:

err: AuthenticationFailed: Missing expected field "pwd"

pwd is a short name for password.

Try passing it in with the --password argument.

You might also try Compass which allows you to paste the connection string straight into the tool as a way to validate that you are doing the right thing.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.