0

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?

borrrden
  • 33,256
  • 8
  • 74
  • 109

2 Answers2

2

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.

Simon Baslé
  • 27,105
  • 5
  • 69
  • 70
0

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])
Samar
  • 2,091
  • 1
  • 15
  • 18