# MongoDBStore

> **Class** in `langchain_community`

📖 [View in docs](https://reference.langchain.com/python/langchain-community/storage/mongodb/MongoDBStore)

BaseStore implementation using MongoDB as the underlying store.

## Signature

```python
MongoDBStore(
    self,
    connection_string: str,
    db_name: str,
    collection_name: str,
    *,
    client_kwargs: Optional[dict] = None,
)
```

## Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `connection_string` | `str` | Yes | MongoDB connection string |
| `db_name` | `str` | Yes | name to use |
| `collection_name` | `str` | Yes | collection name to use |
| `client_kwargs` | `dict` | No | Keyword arguments to pass to the Mongo client (default: `None`) |

## Extends

- `BaseStore[str, Document]`

## Constructors

```python
__init__(
    self,
    connection_string: str,
    db_name: str,
    collection_name: str,
    *,
    client_kwargs: Optional[dict] = None,
) -> None
```

| Name | Type |
|------|------|
| `connection_string` | `str` |
| `db_name` | `str` |
| `collection_name` | `str` |
| `client_kwargs` | `Optional[dict]` |


## Properties

- `client`
- `collection`

## Methods

- [`mget()`](https://reference.langchain.com/python/langchain-community/storage/mongodb/MongoDBStore/mget)
- [`mset()`](https://reference.langchain.com/python/langchain-community/storage/mongodb/MongoDBStore/mset)
- [`mdelete()`](https://reference.langchain.com/python/langchain-community/storage/mongodb/MongoDBStore/mdelete)
- [`yield_keys()`](https://reference.langchain.com/python/langchain-community/storage/mongodb/MongoDBStore/yield_keys)

---

[View source on GitHub](https://github.com/langchain-ai/langchain-community/blob/4b280287bd55b99b44db2dd849f02d66c89534d5/libs/community/langchain_community/storage/mongodb.py#L127)