Command line login fail


I got this error from command line ‘mongo’ (per connect method from the company site). Could someone point me to the right direction? I migrated to atlas from classic mongo about month so ago.

Thank you!!


2021-01-03T10:15:04.722-0500 I NETWORK  [js] Marking host as failed :: caused by :: Location8000: can't authenticate against replica set node :: caused by :: Authentication failed.
2021-01-03T10:15:04.722-0500 E QUERY    [js] Error: can't authenticate against replica set node :: caused by :: Authentication failed. :
exception: login failed

This usually means wrong user name or password. Verify your credentials.

Welcome to the MongoDB community @Michael_Chen!

As @steevej suggested, a likely issue is that you have the wrong credentials for connecting to Atlas.

Note that the credentials for Atlas User Access (logging in via the Atlas UI) are not the same as those for a Database User. If you are trying to use an email address as the username in your mongo shell connection, it is likely that is an Atlas User rather than a Database User.

I would also check that you are using a version of the mongo shell which is at least as new as the server version your Atlas cluster is using. If you are using a significantly older shell, it may be lacking required support for TLS encryption or compatible authentication methods.

For more suggestions on authentication issues, please see the Atlas guide to Troubleshoot Connection Issues.

If you are still having trouble connecting, please provide an example of the mongo command line you are using (with any user/password/cluster details replaced) as well as the output of mongo --version.


I think I got it. You all right.

Am bit lazy to figure out after classic mongo to atlas mongo why the code is not returning the expected result. I can see the data is there (via online dashboard)

const client = new MongoClient(uri, { useNewUrlParser: true });

client.connect(err => {
const collection = client.db(“mydb”).collection(“mycollection”);
// dont seems show any my data in ‘collection’ ???