| { |
| "tests": [ |
| { |
| "description": "update-paths: multiple ArrayUnion fields", |
| "comment": "A document can have more than one ArrayUnion field.\nSince all the ArrayUnion fields are removed, the only field in the update is \"a\".", |
| "updatePaths": { |
| "docRefPath": "projects/projectID/databases/(default)/documents/C/d", |
| "fieldPaths": [ |
| { |
| "field": [ |
| "a" |
| ] |
| }, |
| { |
| "field": [ |
| "b" |
| ] |
| }, |
| { |
| "field": [ |
| "c" |
| ] |
| } |
| ], |
| "jsonValues": [ |
| "1", |
| "[\"ArrayUnion\", 1, 2, 3]", |
| "{\"d\": [\"ArrayUnion\", 4, 5, 6]}" |
| ], |
| "request": { |
| "database": "projects/projectID/databases/(default)", |
| "writes": [ |
| { |
| "update": { |
| "name": "projects/projectID/databases/(default)/documents/C/d", |
| "fields": { |
| "a": { |
| "integerValue": "1" |
| } |
| } |
| }, |
| "updateMask": { |
| "fieldPaths": [ |
| "a", |
| "c" |
| ] |
| }, |
| "currentDocument": { |
| "exists": true |
| } |
| }, |
| { |
| "transform": { |
| "document": "projects/projectID/databases/(default)/documents/C/d", |
| "fieldTransforms": [ |
| { |
| "fieldPath": "b", |
| "appendMissingElements": { |
| "values": [ |
| { |
| "integerValue": "1" |
| }, |
| { |
| "integerValue": "2" |
| }, |
| { |
| "integerValue": "3" |
| } |
| ] |
| } |
| }, |
| { |
| "fieldPath": "c.d", |
| "appendMissingElements": { |
| "values": [ |
| { |
| "integerValue": "4" |
| }, |
| { |
| "integerValue": "5" |
| }, |
| { |
| "integerValue": "6" |
| } |
| ] |
| } |
| } |
| ] |
| } |
| } |
| ] |
| } |
| } |
| } |
| ] |
| } |