Skip to content

Commit e128d77

Browse files
authored
Add Firestore ArrayUnion merge test (#42)
1 parent a3a00aa commit e128d77

File tree

1 file changed

+48
-0
lines changed

1 file changed

+48
-0
lines changed
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
{
2+
"tests": [
3+
{
4+
"description": "set: merge ArrayUnion field",
5+
"comment": "An ArrayUnion value can occur at any depth. In this case,\nthe transform applies to the field path \"b.c\". \"a\" is left alone and remains in the object.",
6+
"set": {
7+
"option": {
8+
"all": true
9+
},
10+
"docRefPath": "projects/projectID/databases/(default)/documents/C/d",
11+
"jsonData": "{\"a\": 1, \"b\": {\"c\": [\"ArrayUnion\", \"foo\", \"bar\"]}}",
12+
"request": {
13+
"database": "projects/projectID/databases/(default)",
14+
"writes": [
15+
{
16+
"update": {
17+
"name": "projects/projectID/databases/(default)/documents/C/d",
18+
"fields": {
19+
"a": {
20+
"integerValue": "1"
21+
}
22+
}
23+
},
24+
"updateMask": {
25+
"fieldPaths": ["a"]
26+
},
27+
"updateTransforms": [
28+
{
29+
"fieldPath": "b.c",
30+
"appendMissingElements": {
31+
"values": [
32+
{
33+
"stringValue": "foo"
34+
},
35+
{
36+
"stringValue": "bar"
37+
}
38+
]
39+
}
40+
}
41+
]
42+
}
43+
]
44+
}
45+
}
46+
}
47+
]
48+
}

0 commit comments

Comments
 (0)