Custom TTL on stored documents and automatic removal by the CB server

Hi dear CouchBase (CB) community & community managers.

We’re looking for a way to store documents in CB with a certain TTL. For instance, storing information about a certain transaction for only 14 days, and rely on CouchBase to automatically remove this document when the said period (14 days) passes.

Can someone please help us with an explanation on how to implement this functionality?

Alex

See Modifying Expiration in the Document Operations section of the manual.

Thank you for the help.

We did a few tests with storing temporary documents with an upsert and then calling touch:

bucket.upsert(doc);
bucket.touch(id, ttl);

The problem is that CouchBase fails to remove all documents for which we set up a custom TTL.

We used ttl of 1 day, stored about 8,800 documents. CouchBase automatically removed most of them but 1,538 documents are still in the database although it’s been a few days since the documents were originally stored.

Any idea how to deal with this partial removal of temporary objects?

We switched to CB 4.1.1 and it looks like the problem disappeared!

Thanks a lot!