Create a Connection String
You can connect to your MongoDB deployment by providing a connection URI, also called a connection string, which instructs the driver on how to connect to a MongoDB deployment and how to behave while connected.
The connection string includes the hostname or IP address and port of your deployment, the authentication mechanism, user credentials when applicable, and connection options.
To connect to an instance or deployment not hosted on Atlas, see Other Ways to Connect to MongoDB.
Find your MongoDB Atlas Connection String
To retrieve your connection string for the deployment that you created in the previous step, log into your Atlas account and navigate to the Database section and click the Connect button for your new deployment.
Proceed to the Connect your application section and select "Node.js" from the Driver selection menu and the version that best matches the version you installed from the Version selection menu.
Select the Password (SCRAM) authentication mechanism.
Deselect the Include full driver code example to view the connection string.
After completing these steps, you should have a connection string that contains your database username and password.
Note
If you run into issues on this step, ask for help in the MongoDB Community Forums or submit feedback by using the Rate this page tab on the right or bottom right side of this page.