Uploaded image for project: 'Couchbase Python Client Library'
  1. Couchbase Python Client Library
  2. PYCBC-1100

Unable to set TTL greater than 30 days

    XMLWordPrintable

Details

    • Bug
    • Resolution: Incomplete
    • Major
    • None
    • 3.0.6
    • docs, library
    • 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

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

              jared.casey Jared Casey
              mijicherian Miji Cherian (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes

                  PagerDuty