A LangGraph checkpoint saver backed by a MongoDB database.

Hierarchy (view full)

Constructors

Properties

checkpointCollectionName: string
checkpointWritesCollectionName: string
client: MongoClient
db: Db

Methods

  • Parameters

    • config: RunnableConfig<Record<string, any>>

    Returns Promise<undefined | Checkpoint<string, string>>

  • Generate the next version ID for a channel.

    Default is to use integer versions, incrementing by 1. If you override, you can use str/int/float versions, as long as they are monotonically increasing.

    Parameters

    • current: undefined | number
    • _channel: ChannelProtocol<unknown, unknown, unknown>

    Returns number

  • Retrieves a checkpoint from the MongoDB database based on the provided config. If the config contains a "checkpoint_id" key, the checkpoint with the matching thread ID and checkpoint ID is retrieved. Otherwise, the latest checkpoint for the given thread ID is retrieved.

    Parameters

    • config: RunnableConfig<Record<string, any>>

    Returns Promise<undefined | CheckpointTuple>

  • Retrieve a list of checkpoint tuples from the MongoDB database based on the provided config. The checkpoints are ordered by checkpoint ID in descending order (newest first).

    Parameters

    Returns AsyncGenerator<CheckpointTuple, any, unknown>

  • Saves a checkpoint to the MongoDB database. The checkpoint is associated with the provided config and its parent config (if any).

    Parameters

    Returns Promise<RunnableConfig<Record<string, any>>>

  • Saves intermediate writes associated with a checkpoint to the MongoDB database.

    Parameters

    • config: RunnableConfig<Record<string, any>>
    • writes: PendingWrite<string>[]
    • taskId: string

    Returns Promise<void>