简体   繁体   English

使用 Java couchbase SDK 更新多个文档

[英]Updating multiple documents using Java couchbase SDK

I am using java Couchbase sdk in my application.我在我的应用程序中使用 java Couchbase sdk。 I want to update same path with same values for multiple documents.我想为多个文档使用相同的值更新相同的路径。 For example there is a key X with value Y in all these documents.例如,所有这些文档中都有一个值为Y的键X。 I want to update the Key X to have the value Z .我想更新 Key X以具有值Z

I am using the Async bucket's query method and the query that I am using looks like this-我正在使用异步存储桶的查询方法,我使用的查询如下所示-

UPDATE default USE KEYS ["a","b","c"] SET X=Z更新默认使用密钥 ["a","b","c"] SET X=Z

default is the bucket name默认是存储桶名称

a,b,c are the document keys that I want to update. a,b,c 是我要更新的文档键。

My question here is does the sdk guarantees that either all of these keys will be updated or none of them.我的问题是 sdk 是否保证所有这些密钥都将被更新,或者都不更新。 How do I know if all the documents were updated correctly?我如何知道所有文档是否都已正确更新?

N1QL doesn't support transactions (Atomicity is at document level not statement/multi statement level). N1QL 不支持事务(原子性在文档级别而不是语句/多语句级别)。 You should check out JAVA SDK transactions https://docs.couchbase.com/java-sdk/current/howtos/distributed-acid-transactions-from-the-sdk.html您应该查看 JAVA SDK 交易https://docs.couchbase.com/java-sdk/current/howtos/distributed-acid-transactions-from-the-sdk.html

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM