Setup
Installation
MongoDBStore ships in the same package as the MongoDB checkpointer:
Credentials
Set your Atlas connection string:Usage
Create aMongoDBStore with fromConnString (await the promise) and pass it to createAgent. fromConnString connects the client and calls start() to ensure indexes exist. Import MongoDBStore from the package root; there is no /store subpath export.
Memory storage
LangGraph stores memories as JSON documents organized bynamespace and key. Namespaces typically include a user or org ID to keep memories scoped.
The example below configures vector indexing so store.search can run semantic queries. Pass an embeddings instance and indexConfig. Install @langchain/openai if you use OpenAIEmbeddings (or swap in another embeddings class):
Read long-term memory in tools
Tools can read from the store using theruntime parameter, which LangGraph injects automatically:
Write long-term memory from tools
Tools can also write to the store usingruntime.store.put, persisting data that survives across threads:
See also
Connect these docs to Claude, VSCode, and more via MCP for real-time answers.

