MongoDB Atlas is a fully managed cloud database available in AWS, Azure, and GCP. It supports native vector search, full-text search (BM25), and hybrid search on your MongoDB document data.
MongoDBAtlasHybridSearchRetriever combines vector search and full-text search using Reciprocal Rank Fusion (RRF) to return the most relevant documents from an Atlas collection. For keyword retrieval without a vector index, MongoDBAtlasFullTextSearchRetriever uses Atlas Search’s Lucene (BM25) analyzer.
Both retrievers subclass BaseRetriever and ship in the langchain-mongodb package. You can also cast a MongoDB Atlas vector store to a retriever with .as_retriever(). Use the dedicated retriever classes when you need hybrid or full-text-only search.
This guide helps you get started with the MongoDB Atlas retriever. For detailed documentation of all MongoDBAtlasHybridSearchRetriever features and configurations, see the API reference.
Setup
You need a running MongoDB Atlas cluster with Atlas Search enabled. Create a cluster in the Atlas UI if you do not already have one.MongoDBAtlasHybridSearchRetriever requires two search indexes on the target collection:
- A vector search index for semantic recall
- A full-text search index for keyword recall
Installation
Installlangchain-mongodb. The following examples also use Voyage AI embeddings:
Configure
Set your Atlas connection string and open a collection handle:Create indexes
Create a vector search index and a full-text search index on the collection before you use hybrid search. Matchdimensions to your embeddings model (voyage-4-lite uses 1024):
Instantiation
Hybrid search
MongoDBAtlasHybridSearchRetriever fuses vector and keyword results with RRF. Increasing vector_penalty or fulltext_penalty reduces the weight of that channel:
Full-text search
MongoDBAtlasFullTextSearchRetriever runs BM25 keyword search and does not require a vector index:
Usage
Use within a chain
API reference
For detailed documentation of allMongoDBAtlasHybridSearchRetriever features and configurations, see the API reference.
For full-text search, see MongoDBAtlasFullTextSearchRetriever.
Connect these docs to your agent of choice via MCP for real-time answers.

