-
Type:
Task
-
Resolution: Fixed
-
Priority:
Unknown
-
Affects Version/s: None
-
None
-
Python Drivers
-
Not Needed
-
None
-
None
-
None
-
None
-
None
-
None
Context
Hello, we are interested in adding a TTL to our existing checkpoints collection, but are having issues doing so. I think the root cause is this line. By default, mongodb will create an index on the ID column when the collection is created. This means, in combination with the "main" checkpoint collection index, the total number of indices in any existing checkpoint collection will be 2, meaning the addition of the TTL index is ignored.
Is this expected behavior? And if so, is there a recommended way to go about adding this? It's easy enough to add the index manually, but it would be nice if the library was able to handle this scenario automatically by checking for these indices by field and/or name, rather than relying upon a count.
Just found another potential bug. When inserting checkpoints, datetime.now() is used (source). For applications that are running under a different timezone than the corresponding MongoDB instance, this can result in documents expiring earlier or later than intended. To prevent this, datetime.now(timezone.utc) should be used instead.