Couchbase v6.0 : Update Document content without resetting Document Expiration (TTL) value

房东的猫 提交于 2020-01-04 05:59:10

问题


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.


回答1:


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.




回答2:


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"



来源:https://stackoverflow.com/questions/59222862/couchbase-v6-0-update-document-content-without-resetting-document-expiration

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!