A document with expiry set is never deleted if the last operation did a Bucket.get(docId) or bucket.update.
looks like Couchbase is resetting the document expiry?
getAndTouch expires the document (document gets deleted) but changes the cas value but returned document wouldn’t have the latest CAS
Update will indeed update the expiry - the expiry is set by the last operation which modifies a document. A straightforward Get() should not update the expiry, however.
What version of Couchbase Server are you running? I recall a bug in this area in a previous version (where the CAS returned from getAndTouch() was incorrect), but I believe it’s fixed in the most recent release.
thanks, I’m using 4.5.1
also why would update query update the expiry if it wasn’t specifically asked to be updated?
That’s simply the semantics of expiry - every time a document is mutated the expiry is set to whatever value is specified in the mutation; and by default if you don’t set expiry it will default to 0 (i.e. don’t expire).
Ok, so it looks like you’ve encountered https://issues.couchbase.com/browse/MB-23976, which is fixed in 5.0.0 and upwards.
we just started migrating to 5