简体   繁体   中英

Couchbase UPDATE not updating all documents matching filter?

I have a very strange situation with the following N1QL update statement:

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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