Skip to main content

langraph-store-mongodb

LangGraph long-term memory using MongoDB.

Installation

pip install -U langgraph-store-mongodb

Usage

For more detailed usage examples and documentation, please refer to the MongoDB LangGraph documentation.

from langgraph.store.mongodb import MongoDBStore, create_vector_index_config
from langchain_voyageai import VoyageAIEmbeddings

# Vector search index configuration with client-side embedding
index_config = create_vector_index_config(
    embed = VoyageAIEmbeddings(),
    dims = <dimensions>,
    fields = ["<field-name>"],
    filters = ["<filter-field-name>", ...] # Optional
)

# Store memories in MongoDB collection
with MongoDBStore.from_conn_string(
     conn_string=MONGODB_URI,
     db_name="<database-name>",
     collection_name="<collection-name>",
     index_config=index_config
 ) as store:
     store.put(
         namespace=("user", "memories"),
         key=f"memory_{hash(content)}",
         value={"content": content}
     )

# Retrieve memories from MongoDB collection
with MongoDBStore.from_conn_string(
    conn_string=MONGODB_URI,
    db_name="<database-name>",
    collection_name="<collection-name>",
    index_config=index_config
) as store:
     results = store.search(
         ("user", "memories"),
         query="<query-text>",
         limit=3
     )
     for result in results:
         print(result.value)

# To delete memories, use store.delete(namespace, key)
# To batch operations, use store.batch(ops)

Metadata

Release files for langgraph-store-mongodb 0.4.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for langgraph-store-mongodb 0.4.0
File Size Uploaded
langgraph_store_mongodb-0.4.0.tar.gz 187.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for langgraph-store-mongodb 0.4.0
File Interpreter ABI Platform
langgraph_store_mongodb-0.4.0-py3-none-any.whl Python 3 none any Details

Total release size: 199.5 kB

Release files / langgraph_store_mongodb-0.4.0.tar.gz

Download URL langgraph_store_mongodb-0.4.0.tar.gz
Size 187.3 kB
Tags Source
SHA-256 checksum
How to use checksums
da319dcd0bb2c8d7de75c521a65539cdd352144509a21f70d71eb6a2b6e8b42b
BLAKE2b-256 checksum
How to use checksums
8e4415fdd94f3ba4f7df776a086be031cefdb0ba84ec77643ef17ae74df607e6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / langgraph_store_mongodb-0.4.0-py3-none-any.whl

Download URL langgraph_store_mongodb-0.4.0-py3-none-any.whl
Size 12.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c2b6e276d248b9cf0531d90cd6cf520c4cf5ff987c7a424b1be319de677ed92c
BLAKE2b-256 checksum
How to use checksums
e3f460bf266c35e418e60d443694f922f63d829c9f97c376a099bc5488ae6737
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Release history Release notifications | RSS feed

This release

0.4.0 This release

2 release files

0.3.0

2 release files

0.2.0

2 release files

0.1.1

2 release files

0.1.0

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page