I have a problem connecting to MongoDB can someone guide me to resolve this issue

Mac OS Catalina version 10.15.7
MongoDB shell version v4.2.3
git version: 6874650b362138df74be53d366bbefc321ea32d4
allocator: system
modules: none
build environment:
distarch: x86_64
target_arch: x86_64
*** It looks like this is a MongoDB Atlas cluster. Please ensure that your IP whitelist allows connections from your network.

2021-01-06T11:50:11.288+0500 E QUERY [js] Error: Authentication failed. :
connect@src/mongo/shell/mongo.js:341:17
@(connect):2:6
2021-01-06T11:50:11.293+0500 F - [main] exception: connect failed
2021-01-06T11:50:11.293+0500 E - [main] exiting with code 1

Welcome to the MongoDB community @Muhammad_Numan!

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

2021-01-06T11:50:11.288+0500 E QUERY [js] Error: Authentication failed.

Based on the quoted messages, it looks like you may not have the correct credentials to connect to an Atlas cluster.

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.

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).

Regards,
Stennie

Thank you i have found a solution.

Hi @Muhammad_Numan,

Glad you found a solution! It would be helpful if you are able to share the solution here, as others may encounter a similar issue and benefit from your experience.

Regards,
Stennie

1 Like