Construct Retriever using one Collection for VectorStore and one for DocStore
See parent classes
:class:~langchain.retrievers.parent_document_retriever.ParentDocumentRetriever
and :class:~langchain.retrievers.MultiVectorRetriever for further details.
from_connection_string(
cls,
connection_string: str,
embedding_model: Embeddings,
child_splitter: TextSplitter,
database_name: str,
collection_name: str = 'document_with_chunks',
id_key: str = 'doc_id',
auto_create_index: bool = True,
auto_index_timeout: int = 15,
search_index_name: str = 'text_index',
search_field: Optional[str] = None,
**kwargs: Any = {}
) -> MongoDBAtlasParentDocumentRetrieverReturns: A new MongoDBAtlasParentDocumentRetriever
| Name | Type | Description |
|---|---|---|
connection_string* | str | A valid MongoDB Atlas connection URI. |
embedding_model* | Embeddings | The text embedding model to use for the vector store. |
child_splitter* | TextSplitter | Splits documents into chunks. If parent_splitter is given, the documents will have already been split. |
database_name* | str | Name of database to connect to. Created if it does not exist. |
collection_name | str | Default: 'document_with_chunks'Name of collection to use. It includes parent documents, sub-documents and their embeddings. |
id_key | str | Default: 'doc_id'Key used to identify parent documents. |
auto_create_index | bool | Default: TrueWhether to automatically create the full-text search index if it does not exist. Defaults to True. |
auto_index_timeout | int | Default: 15How long to wait for the automatic index creation to complete, in seconds |
search_index_name | str | Default: 'text_index'Name of the full-text search index to create when auto_create_index is True. Defaults to "text_index". |
search_field | Optional[str] | Default: NoneField to index for full-text search. Defaults to the vectorstore text key. |
**kwargs | Any | Default: {}Additional keyword arguments. See parent classes for more. |