At the time of updating the document, I need to change the TTL according to the value of a field.
Does Couchbase support changing TTL once the document is created?
At the time of updating the document, I need to change the TTL according to the value of a field.
Does Couchbase support changing TTL once the document is created?
If you're not mutating the document other than resetting the TTL, use touch
.
If you're mutating the document as well, use one of the overrides that allows you to also set the TTL on replace
and upsert
.
Yes, you can update the TTL of an existing document. Use the replace method which accepts doc id and a TTL value
client.replace(key, expiry, value [, persistTo] ,[ replicateTo])