Reputation: 31
I am using.Net Couchbase SDK(CouchbaseNetClient Package) to create a new document and while doing so I set the expiry value for the document. The expiry(TTL) value sets properly and works fine too.
Problem Statment- Once the document has been created, I need to update some of its content for which I am using N1QL. Here the problem arises, it resets the document expiry value to 0. Is there any way to not reset the document expiry while updating a document content.
Upvotes: 3
Views: 459
Reputation: 575
As @vsr mentioned, you cannot currently maintain the TTL of a document via a N1QL DML statement. The only way in 6.0 (and before) that you can insert a document with an expiration is via the SDK.
What you can do however, is to use N1QL as a method or retrieving the TTL if you want to manipulate it on the SDK level.
for example: Select meta().expiration from bucket where meta().id = "xyz"
Upvotes: 3
Reputation: 7414
Any mutation with N1QL (UPDATE, INSERT, UPSERT, MERGE) will always set the expiration value to 0.
Setting the expiration through the N1QL is on the roadmap.
Upvotes: 4