MongoDB CheckpointSaver: No date field available for TTL index support in current schema #296

Open
opened 2026-02-15 18:15:35 -05:00 by yindo · 2 comments
Owner

Originally created by @yishaistern on GitHub (Jul 3, 2025).

I'm using the CheckpointSaver with MongoDB for persistence and would like to set up a TTL index to automatically expire old checkpoints. However, I noticed that the current MongoDB documents don't include a Date-type field that can be used for TTL purposes. It would be great to have a timestamp (e.g., createdAt) added to the saved checkpoints to support this use case.
at this point schema looks like this:
{ "_id": { "$oid": "" }, "checkpoint_id": "", "checkpoint_ns": "", "thread_id": "", "checkpoint": { "$binary": { "base64": "", "subType": "00" } }, "metadata": { "$binary": { "base64": "", "subType": "00" } }, "parent_checkpoint_id": "", "type": "json" }
None of these are Date type

Originally created by @yishaistern on GitHub (Jul 3, 2025). I'm using the CheckpointSaver with MongoDB for persistence and would like to set up a TTL index to automatically expire old checkpoints. However, I noticed that the current MongoDB documents don't include a Date-type field that can be used for TTL purposes. It would be great to have a timestamp (e.g., createdAt) added to the saved checkpoints to support this use case. at this point schema looks like this: `{ "_id": { "$oid": "" }, "checkpoint_id": "", "checkpoint_ns": "", "thread_id": "", "checkpoint": { "$binary": { "base64": "", "subType": "00" } }, "metadata": { "$binary": { "base64": "", "subType": "00" } }, "parent_checkpoint_id": "", "type": "json" }` None of these are Date type
yindo added the enhancement label 2026-02-15 18:15:35 -05:00
Author
Owner

@sdip0971 commented on GitHub (Jul 15, 2025):

Hey! Just opened a PR to implement this enhancement 👉 https://github.com/langchain-ai/langgraphjs/pull/1401

Adds optional TTL support for MongoDB-based checkpoint saver using a _createdAtForTTL Date field
Supports opt-in TTL cleanup with enableTTL flag
Keeps backward compatibility — no breaking changes

Let me know if anything else is needed!

@sdip0971 commented on GitHub (Jul 15, 2025): Hey! Just opened a PR to implement this enhancement 👉 https://github.com/langchain-ai/langgraphjs/pull/1401 ✅ Adds optional TTL support for MongoDB-based checkpoint saver using a `_createdAtForTTL` Date field ✅ Supports opt-in TTL cleanup with `enableTTL` flag ✅ Keeps backward compatibility — no breaking changes Let me know if anything else is needed!
Author
Owner

@tom-n-terra commented on GitHub (Oct 12, 2025):

@dqbd any progress on that?

@tom-n-terra commented on GitHub (Oct 12, 2025): @dqbd any progress on that?
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langchain-ai/langgraphjs#296