Back to Builder

MongoDB Atlas Vector Search Setup

Follow this step-by-step guide to configure your database for AI-powered retrieval.

1

Create an Atlas Cluster

Go to MongoDB Atlas and create a new cluster.

  • The M0 Free Tier is supported.
  • Ensure you whitelist your IP address in Network Access.
  • Create a database user with read/write permissions.
2

Get your Connection String

Click Connect on your cluster, select Drivers, and copy your connection string.

mongodb+srv://username:<password>@cluster0.mongodb.net/rag_builder

* Replace <password> with your actual user password.

3

Create Vector Search Index

This is the most important step for retrieval.

  1. In Atlas, go to Atlas Search from the sidebar.
  2. Click Create Search Index.
  3. Select JSON Editor under Atlas Vector Search.
  4. Select your database and collection (default: vector_store).
  5. Paste the following configuration:
{
  "fields": [
    {
      "numDimensions": 1536,
      "path": "embedding",
      "similarity": "cosine",
      "type": "vector"
    }
  ]
}

Important Note on Types

Ensure numDimensions is an integer (not surrounded by quotes). If you see an "Invalid definition" error, double check that the value is exactly 1536 (without quotes).

6. Click Next and set the Index Name to vector_index.

7. Click Create Search Index. It may take a minute to activate.

4

Verify and Test

Go back to the RAG Builder, update your settings with the new Connection String, and try uploading a document.

If setup correctly, you'll be able to chat with your documents immediately!