How to create embeddings and retrieval queries for MongoDB documents with a nested structure using LangChain?

Hello @Vishnu_Priyan

For your first question, the only way to store embeddings for documents that are already in your collection is to go through and update each one by adding a field that holds the new Vector Embedding. (The embedding would be created by sending the relevant data to an embedding model to create the embedding).

Creating a vector search index can be done through the UI or API - instructions are here

To retrieve results, you must take the users input and create a vector with it, then you will pass that vector to the $vectorSearch stage documented here.

2 Likes