Registering with MongoDB Atlas

Creating a free MongoDB Atlas account and obtaining a connection string for use with Express apps.

Learning Goals

At the end of this Tutorial, you will be able to:

  • Create a free account with the online MongoDB Atlas service.
  • Obtain a connection string that you can use with your Express apps.

About MongoDB Altas

MongoDB Atlas is an online hosted service that provides an integrated suite of data services centred around a cloud NoSQL database. A free-forever user tier is available.

screenshot

Signing up to MongoDB Altas

Follow the steps below.

  1. Go to the MongoDB website at https://www.mongodb.com/ and click the green Try free button at the top right. screenshot
  2. Enter an email address and password or use a Gmail account. screenshot
  3. Accept the Terms of Service and Privacy Policy, and click the Create your Atlas account button. screenshot If you have not used a Gmail account to sign up, you will be asked to confirm your email address. Next, a Welcome screen will appear briefly. screenshot
  4. Respond to the user questionnaire. screenshot When complete, click the Finish button.
  5. On the Deploy a cloud database screen, in the FREE Shared box, click the Create button. screenshot
  6. On the Database Deployments screen, click the Build a database button. screenshot This will create a number of sample databases for you to experiment with.
  7. On the Create a Shared Cluster screen, accept or amend the default values for Cloud Provider & Region. screenshot
  8. Next, accept or amend the default Cluster Name of Cluster0. screenshot
  9. When finished, click the Create Cluster button.
  10. On the Security Quickstart screen, choose Username and Password. screenshot
  11. Enter a Username and Password and click the Next button.
  12. Create a database user Username and Password and click the Create User button. screenshot
  13. Accept the default connection location of My Local Environment. screenshot
  14. Enter the permitted IP address(es) for accessing your database and click the Add Entry button. For this experimental database, you can enter 0.0.0.0. screenshot
  15. Finally, at the bottom of the screen, click the Finish and Close button.
  16. You should now see a message similar to the following. Click the Go to Databases button. screenshot
  17. You should now see a Database Deployments screen, telling you that your Cluster is being created. This may take a few minutes to complete. screenshot
  18. When is Cluster is built, click the Connect button. screenshot
  19. In the pop-up dialog box now displayed, choose Drivers. screenshot
  20. In the next pop-up dialog box now displayed, choose Node.js and 5.5 or later. screenshot Copy the MongoDB connection string to a text file on your machine and save the file.
  21. Close the Close button.

Reviewing your MongoDB account

You have now signed up as a user of the free tier of MongoDB Atlas. Note the following:

  • You have not actually created a new database.   However, the database user with the Username and Password you created has access to a number of free sample databases you can experiment with.
  • You have obtained a connection string that you can use to connect to MongoDB from an Express app.   The connection string does not include the name of a particular database.
  • MongoDB Atlas suggests you connect your Express apps using its native client driver, which you can install by running this command in your app folder:
       npm install mongodb
    However, a better option for connecting your Express apps is to use the Mongoose module instead.   See the next Tutorial for more information.