Skip to main content

MongoDB Atlas

How to set up an online MongoDB database for IntelliAsk using MongoDB Atlas

Create a MongoDB Atlas Account

  1. Open a new tab in your web browser and go to account.mongodb.com/account/register.
  2. Fill out the required information and create your account.

Create a New Project

After setting up your account, click on the "New Project" button and give it a name (e.g., "IntelliAsk").

Build a Database

Click on the "Build a Database" button.

Choose the Free Tier

Select the "Shared Clusters" option, which is the free tier.

Name Your Cluster

Give your cluster a name (e.g., "IntelliAsk-Cluster") and click "Create Cluster".

Set Up Database Credentials

  1. Click on the "Database & Network Access" option in the sidebar.
  2. Click on the "Add New Database User" button.
  3. Enter a username and a secure password, then click "Add User".

Configure Network Access

  1. Click on the "IP Access List" option in the sidebar.
  2. Click on the "Add IP Address" button.
  3. Enter "0.0.0.0/0" and click "Confirm".

Get Your Connection String

  1. Click on the "Project Overview" option in the sidebar.
  2. In "Application Development" click "Get connection string".
  3. Click on the "Connect" button.
  4. Select "Connect Your Application".
  5. Copy the connection string provided.
  6. Replace <db_username> and <db_password> in the connection string with the username password you set in the credentials step. Remove the <> characters around the password.

Your final connection string should look something like this:

mongodb+srv://username:password@cluster-url.mongodb.net/IntelliAsk?retryWrites=true

Update the .env File

  1. In your IntelliAsk project, open the .env file.
  2. Find the MONGO_URI variable and paste your connection string:
MONGO_URI=mongodb+srv://username:password@cluster-url.mongodb.net/IntelliAsk?retryWrites=true

That's it! You've now set up an online MongoDB database for IntelliAsk using MongoDB Atlas, and you've updated your IntelliAsk application to use this database connection. Your application should now be able to connect to the online MongoDB database.

Note about Docker

Docker

Note: If you're using IntelliAsk with Docker, you'll need to utilize the docker-compose.override.yml file. This override file allows you to prevent the installation of the included MongoDB instance. Instead, your IntelliAsk Docker container will use the online MongoDB Atlas database you've just set up. For more information on using the override file, please refer to our Docker Override Guide.

Last updated on