LangChain Reference home pageLangChain ReferenceLangChain Reference
  • GitHub
  • Main Docs
Deep Agents
LangChain
LangGraph
Integrations
LangSmith
LangGraph
  • Web
  • Channels
  • Pregel
  • Prebuilt
  • Remote
React SDK
Vue SDK
Svelte SDK
Angular SDK
LangGraph SDK
  • Ui
  • Client
  • Auth
  • React
  • Logging
  • React Ui
  • Utils
  • Server
LangGraph Checkpoint
LangGraph Checkpoint MongoDB
LangGraph Checkpoint Postgres
  • Store
LangGraph Checkpoint Redis
  • Shallow
  • Store
LangGraph Checkpoint SQLite
LangGraph Checkpoint Validation
  • Cli
LangGraph API
LangGraph CLI
LangGraph CUA
  • Utils
LangGraph Supervisor
LangGraph Swarm
⌘I

LangChain Assistant

Ask a question to get started

Enter to send•Shift+Enter new line

Menu

LangGraph
WebChannelsPregelPrebuiltRemote
React SDK
Vue SDK
Svelte SDK
Angular SDK
LangGraph SDK
UiClientAuthReactLoggingReact UiUtilsServer
LangGraph Checkpoint
LangGraph Checkpoint MongoDB
LangGraph Checkpoint Postgres
Store
LangGraph Checkpoint Redis
ShallowStore
LangGraph Checkpoint SQLite
LangGraph Checkpoint Validation
Cli
LangGraph API
LangGraph CLI
LangGraph CUA
Utils
LangGraph Supervisor
LangGraph Swarm
Language
Theme
JavaScript@langchain/langgraph-checkpoint-mongodbMongoDBStore
Class●Since v0.0

MongoDBStore

A long-term persistent key-value store backed by MongoDB. Supports hierarchical namespace organization with Put, Get, ListNamespaces, and Search operations.

Copy
class MongoDBStore

Bases

BaseStore

Constructors

Properties

Methods

Inherited fromBaseStore(langchain_core)

Methods

MmgetMamgetMmsetMamsetMmdelete
View source on GitHub
M
amdelete
Myield_keys
Mayield_keys
constructor
constructor→ MongoDBStore
property
client: MongoClient
property
collectionName: string
property
db: Db
property
embeddings: EmbeddingsInterface<number[]>
property
enableTimestamps: boolean
property
indexConfig: IndexConfig
property
ownsClient: boolean
property
ttl: TTLConfig
method
batch→ Promise<OperationResults<Op>>
method
delete→ Promise<void>
method
get→ Promise<Item | null>
method
listNamespaces→ Promise<string[][]>
method
put→ Promise<void>
method
search→ Promise<SearchItem[]>
method
start→ Promise<void>
method
stop→ Promise<void>
method
fromConnString→ Promise<MongoDBStore>

Execute a batch of operations (Put, Get, ListNamespaces, Search). Operations are processed in order, but multiple consecutive Puts are batched. PutOperations are deduplicated by (namespace, key) — last write wins.

Delete an item from the store.

Retrieve a single item by its namespace and key.

List and filter namespaces in the store. Used to explore data organization and navigate the namespace hierarchy.

Store or update an item.

Search for items within a namespace prefix. Supports both metadata filtering and vector similarity search.

Initialize the store: creates the {namespace, key} unique index and an optional TTL index.

Clean up the store. Closes the underlying MongoClient only if the store created it (i.e. via fromConnString). When the client was supplied to the constructor by the caller, the caller owns its lifecycle.

Factory method to create a MongoDBStore from a connection string. Automatically creates and connects a MongoDB client, and calls start to ensure required indexes exist.