简体   繁体   English

Couchbase UPDATE是否不更新所有匹配筛选器的文档?

[英]Couchbase UPDATE not updating all documents matching filter?

I have a very strange situation with the following N1QL update statement: 以下N1QL更新语句使我感到非常奇怪:

update  testBucket set A1='TESTVALUE' where TONUMBER(`Respondent.Serial`) = 8

{"results": []}



select А1 from testBucket where TONUMBER(`Respondent.Serial`) = 8

I get tthe following (notice that not all is updated), having: 我得到以下内容(注意,并非所有内容都已更新):

      {
        "A1": "ONE"
      },
      {
        "A1": "TESTVALUE"
      },

      {
        "A1": "TESTVALUE"
      },
      {
        "A1": "TESTVALUE"
      },
      {
        "A1": "TESTVALUE"
      },
      {
        "A1": "TESTVALUE"
      },
      {
        "A1": "TEST2"
      }

The problem may be that you are using backticks around Respondent.Serial. 问题可能是您在Respondent.Serial周围使用反引号。

If your document structure is like this, that isn't right. 如果您的文档结构是这样,那是不对的。

{
  "Respondent": {
      "Serial": "8"
  }
}

You should only be using the backticks if you have a single field name that includes the period, like this: 仅当您有一个包含句点的字段名称时,才应使用反引号,如下所示:

{
  "Respondent.Serial": "8"
}

Assuming you have the former document structure, try your queries without the backticks. 假定您具有以前的文档结构,请尝试不带反引号的查询。

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

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