Skip to main content

Mongodb Setup

tip

Mongodb is used to save vector embeddings for RAG feature. This is required when mongodb is used as RAG vector store i.e. RAG_VECTOR_STORE_TYPE=mongodb

Env variables

apps/api/.env
RAG_VECTOR_STORE_MONGODB_URI=...
RAG_VECTOR_STORE_MONGODB_SEARCH_INDEX=...

Visit mongodb atlas platform to create database and search index

1. Create a database

create-database

2. Create search index

create-search-index

Use the json editor to setup the search index as follows. Please take note of the search index name to use in .env

{
"fields": [
{
"numDimensions": 512,
"path": "embeddings",
"similarity": "cosine",
"type": "vector"
},
{
"path": "documentId",
"type": "filter"
}
]
}