@@ -40,6 +40,7 @@ class MongoDBSaver(BaseCheckpointSaver):
40
40
db_name (Optional[str]): Database name
41
41
checkpoint_collection_name (Optional[str]): Name of Collection of Checkpoints
42
42
writes_collection_name (Optional[str]): Name of Collection of intermediate writes.
43
+ ttl (Optional[int]): Time to live in seconds.
43
44
44
45
Examples:
45
46
@@ -117,6 +118,7 @@ def from_conn_string(
117
118
db_name : str = "checkpointing_db" ,
118
119
checkpoint_collection_name : str = "checkpoints" ,
119
120
writes_collection_name : str = "checkpoint_writes" ,
121
+ ttl : Optional [int ] = None ,
120
122
** kwargs : Any ,
121
123
) -> Iterator ["MongoDBSaver" ]:
122
124
"""Context manager to create a MongoDB checkpoint saver.
@@ -133,6 +135,7 @@ def from_conn_string(
133
135
db_name: Database name. It will be created if it doesn't exist.
134
136
checkpoint_collection_name: Checkpoint Collection name. Created if it doesn't exist.
135
137
writes_collection_name: Collection name of intermediate writes. Created if it doesn't exist.
138
+ ttl (Optional[int]): Time to live in seconds.
136
139
Yields: A new MongoDBSaver.
137
140
"""
138
141
client : Optional [MongoClient ] = None
@@ -148,6 +151,7 @@ def from_conn_string(
148
151
db_name ,
149
152
checkpoint_collection_name ,
150
153
writes_collection_name ,
154
+ ttl ,
151
155
** kwargs ,
152
156
)
153
157
finally :
0 commit comments