Details
-
Bug
-
Resolution: Incomplete
-
Major
-
None
-
3.0.6
-
RHEL 7
-
1
Description
If we apply a TTL of greater than 30 days while inserting the document, the document will get removed immediately.
result = cbCollection.insert(key, doc, expiry=timedelta(days=40))
As per the documentation, If the absolute value of the expiry is greater than 30 days, it is considered an absolute time stamp.Currently python SDK is not giving an option to pass absolute datetime value to expiry parameter.
https://docs.couchbase.com/java-sdk/current/concept-docs/documents.html#setting-document-expiration
I found a workaround for the issue as below.
expiryDate=datetime.now()+timedelta(days=40)
ttl= timedelta(seconds=expiryDate.timestamp())
result = cbCollection.insert(key, doc, expiry=ttl)
if this solution is good, then it will be great to publish this on the below documentation till the SDK provides an option to pass the absolute date or handle this condition within the insert/update/touch function.
https://docs.couchbase.com/python-sdk/current/howtos/kv-operations.html#expiration-ttl
Attachments
Issue Links
- relates to
-
PYCBC-1093 Expiry Refactor part 2
- Open