MongoDB is used as a vector database to store the vector embeddings of the documents. It is also utilized for vector search to retrieve the most relevant document chunks for answering user questions.