Skip to main content

馃憪 Ingest data into MongoDB

The final step to build a MongoDB vector store for our RAG application is to ingest the embedded article chunks into MongoDB.

Fill in any <CODE_BLOCK_N> placeholders and run the cells under the Step 6: Ingest data into MongoDB section in the notebook to ingest the embedded documents into MongoDB.

The answers for code blocks in this section are as follows:

CODE_BLOCK_6

Answer
mongodb_client[DB_NAME][COLLECTION_NAME]

CODE_BLOCK_7

Answer
collection.insert_many(embedded_docs)

To verify that the data has been imported into your MongoDB cluster, navigate to the Overview page in the Atlas UI. In the Clusters section, select your cluster and click Browse collections.

Browse collections

Ensure that you see a database called mongodb_rag_lab, and a collection named knowledge_base under it. Note the number and format of documents in the collection.

Verify collection