# MongoDBAtlasParentDocumentRetriever

> **Class** in `langchain_mongodb`

📖 [View in docs](https://reference.langchain.com/python/langchain-mongodb/retrievers/parent_document/MongoDBAtlasParentDocumentRetriever)

MongoDB Atlas's ParentDocumentRetriever

“Parent Document Retrieval” is a common approach to enhance the performance of
retrieval methods in RAG by providing the LLM with a broader context to consider.
In essence, we divide the original documents into relatively small chunks,
embed each one, and store them in a vector database.
Using such small chunks (a sentence or a couple of sentences)
helps the embedding models to better reflect their meaning.
If two high scoring chunks are contained in the same document,
the query response will include the parent document just once.
One can control the number of chunks found in the vector_search_stage by setting
search_kwargs == {'top_k': n}. The number of query responses will be <= top_k.

In this implementation, we can store both parent and child documents in a single
collection while only having to compute and index embedding vectors for the chunks!

This is achieved by backing both the
vectorstore, :class:`~langchain_mongodb.vectorstores.MongoDBAtlasVectorSearch`
and the docstore  :class:`~langchain_mongodb.docstores.MongoDBDocStore`
by the same MongoDB Collection.

For more details, see superclasses
    :class:`~langchain.retrievers.parent_document_retriever.ParentDocumentRetriever`
    and :class:`~langchain.retrievers.MultiVectorRetriever`.

## Signature

```python
MongoDBAtlasParentDocumentRetriever(
    self,
    *args: Any = (),
    **kwargs: Any = {},
)
```

## Extends

- `ParentDocumentRetriever`

## Constructors

```python
__init__(
    self,
    *args: Any = (),
    **kwargs: Any = {},
) -> None
```


## Properties

- `vectorstore`
- `docstore`
- `id_key`
- `search_kwargs`

## Methods

- [`from_connection_string()`](https://reference.langchain.com/python/langchain-mongodb/retrievers/parent_document/MongoDBAtlasParentDocumentRetriever/from_connection_string)
- [`close()`](https://reference.langchain.com/python/langchain-mongodb/retrievers/parent_document/MongoDBAtlasParentDocumentRetriever/close)

---

[View source on GitHub](https://github.com/langchain-ai/langchain-mongodb/blob/564f3382c37f079c8c94fb92f4a52b6626db9b27/libs/langchain-mongodb/langchain_mongodb/retrievers/parent_document.py#L34)