Need help on the best architecture for my RAG SaaS app

Hi,

I’m quite new to MongoDB Atlas Search and was wondering if someone could help me in how I should setup the architecture for my small SaaS project MVP.

Problem:

  • Have an application that can have multiple clients sign up, where for each, I need to store vector embeddings for certain documents
  • It’s a chat based app so RAG needs to be done to provide context to LLM for chat messages individual to each client
  • Need to understand how to setup collections, indexes, architecture for this ^

Do I either:

  1. Create 1 big collection inside 1 database for all clients, and create a search index that filters based on client_id (as example) to only retrieve the vectors for that client?
  2. Create 1 collection for each client that joins in 1 database, so each time someone signs up for the SaaS, it would create a collection and ingest their docs.

As far as I understand from reading the docs, I should do Option 1 as there is not a lot of data stored per client but please advise me if I’m approaching this in the wrong way.

Hello @nprs

You’re right, Option 1 will be better if you are going to have many individual clients. You will absolutely be able to filter based on client_id, but it’s important to note that not every data type is supported for filtering today so you will want to use a supported field type for your client_id. Right now you can use boolean, numeric and string type fields to filter.

1 Like