1{
2  "tests": [
3    {
4      "description": "update-paths: nested ArrayUnion field",
5      "comment": "An ArrayUnion value can occur at any depth. In this case,\nthe transform applies to the field path \"b.c\". Since \"c\" is removed from the update,\n\"b\" becomes empty, so it is also removed from the update.",
6      "updatePaths": {
7        "docRefPath": "projects/projectID/databases/(default)/documents/C/d",
8        "fieldPaths": [
9          {
10            "field": [
11              "a"
12            ]
13          },
14          {
15            "field": [
16              "b"
17            ]
18          }
19        ],
20        "jsonValues": [
21          "1",
22          "{\"c\": [\"ArrayUnion\", 1, 2, 3]}"
23        ],
24        "request": {
25          "database": "projects/projectID/databases/(default)",
26          "writes": [
27            {
28              "update": {
29                "name": "projects/projectID/databases/(default)/documents/C/d",
30                "fields": {
31                  "a": {
32                    "integerValue": "1"
33                  }
34                }
35              },
36              "updateMask": {
37                "fieldPaths": [
38                  "a",
39                  "b"
40                ]
41              },
42              "currentDocument": {
43                "exists": true
44              }
45            },
46            {
47              "transform": {
48                "document": "projects/projectID/databases/(default)/documents/C/d",
49                "fieldTransforms": [
50                  {
51                    "fieldPath": "b.c",
52                    "appendMissingElements": {
53                      "values": [
54                        {
55                          "integerValue": "1"
56                        },
57                        {
58                          "integerValue": "2"
59                        },
60                        {
61                          "integerValue": "3"
62                        }
63                      ]
64                    }
65                  }
66                ]
67              }
68            }
69          ]
70        }
71      }
72    }
73  ]
74}
75