Skip to content

Commit f77e1ac

Browse files
authored
PYTHON-4961 - Split updateWithPipelines.yml by operation (#2217)
1 parent e99818d commit f77e1ac

6 files changed

+726
-494
lines changed
Lines changed: 148 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,148 @@
1+
{
2+
"description": "bulkWrite-updateMany-pipeline",
3+
"schemaVersion": "1.0",
4+
"runOnRequirements": [
5+
{
6+
"minServerVersion": "4.1.11"
7+
}
8+
],
9+
"createEntities": [
10+
{
11+
"client": {
12+
"id": "client0",
13+
"observeEvents": [
14+
"commandStartedEvent"
15+
]
16+
}
17+
},
18+
{
19+
"database": {
20+
"id": "database0",
21+
"client": "client0",
22+
"databaseName": "crud-tests"
23+
}
24+
},
25+
{
26+
"collection": {
27+
"id": "collection0",
28+
"database": "database0",
29+
"collectionName": "test"
30+
}
31+
}
32+
],
33+
"initialData": [
34+
{
35+
"collectionName": "test",
36+
"databaseName": "crud-tests",
37+
"documents": [
38+
{
39+
"_id": 1,
40+
"x": 1,
41+
"y": 1,
42+
"t": {
43+
"u": {
44+
"v": 1
45+
}
46+
}
47+
},
48+
{
49+
"_id": 2,
50+
"x": 2,
51+
"y": 1
52+
}
53+
]
54+
}
55+
],
56+
"tests": [
57+
{
58+
"description": "UpdateMany in bulk write using pipelines",
59+
"operations": [
60+
{
61+
"object": "collection0",
62+
"name": "bulkWrite",
63+
"arguments": {
64+
"requests": [
65+
{
66+
"updateMany": {
67+
"filter": {},
68+
"update": [
69+
{
70+
"$project": {
71+
"x": 1
72+
}
73+
},
74+
{
75+
"$addFields": {
76+
"foo": 1
77+
}
78+
}
79+
]
80+
}
81+
}
82+
]
83+
},
84+
"expectResult": {
85+
"matchedCount": 2,
86+
"modifiedCount": 2,
87+
"upsertedCount": 0
88+
}
89+
}
90+
],
91+
"expectEvents": [
92+
{
93+
"client": "client0",
94+
"events": [
95+
{
96+
"commandStartedEvent": {
97+
"command": {
98+
"update": "test",
99+
"updates": [
100+
{
101+
"q": {},
102+
"u": [
103+
{
104+
"$project": {
105+
"x": 1
106+
}
107+
},
108+
{
109+
"$addFields": {
110+
"foo": 1
111+
}
112+
}
113+
],
114+
"multi": true,
115+
"upsert": {
116+
"$$unsetOrMatches": false
117+
}
118+
}
119+
]
120+
},
121+
"commandName": "update",
122+
"databaseName": "crud-tests"
123+
}
124+
}
125+
]
126+
}
127+
],
128+
"outcome": [
129+
{
130+
"collectionName": "test",
131+
"databaseName": "crud-tests",
132+
"documents": [
133+
{
134+
"_id": 1,
135+
"x": 1,
136+
"foo": 1
137+
},
138+
{
139+
"_id": 2,
140+
"x": 2,
141+
"foo": 1
142+
}
143+
]
144+
}
145+
]
146+
}
147+
]
148+
}
Lines changed: 156 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,156 @@
1+
{
2+
"description": "bulkWrite-updateOne-pipeline",
3+
"schemaVersion": "1.0",
4+
"runOnRequirements": [
5+
{
6+
"minServerVersion": "4.1.11"
7+
}
8+
],
9+
"createEntities": [
10+
{
11+
"client": {
12+
"id": "client0",
13+
"observeEvents": [
14+
"commandStartedEvent"
15+
]
16+
}
17+
},
18+
{
19+
"database": {
20+
"id": "database0",
21+
"client": "client0",
22+
"databaseName": "crud-tests"
23+
}
24+
},
25+
{
26+
"collection": {
27+
"id": "collection0",
28+
"database": "database0",
29+
"collectionName": "test"
30+
}
31+
}
32+
],
33+
"initialData": [
34+
{
35+
"collectionName": "test",
36+
"databaseName": "crud-tests",
37+
"documents": [
38+
{
39+
"_id": 1,
40+
"x": 1,
41+
"y": 1,
42+
"t": {
43+
"u": {
44+
"v": 1
45+
}
46+
}
47+
},
48+
{
49+
"_id": 2,
50+
"x": 2,
51+
"y": 1
52+
}
53+
]
54+
}
55+
],
56+
"tests": [
57+
{
58+
"description": "UpdateOne in bulk write using pipelines",
59+
"operations": [
60+
{
61+
"object": "collection0",
62+
"name": "bulkWrite",
63+
"arguments": {
64+
"requests": [
65+
{
66+
"updateOne": {
67+
"filter": {
68+
"_id": 1
69+
},
70+
"update": [
71+
{
72+
"$replaceRoot": {
73+
"newRoot": "$t"
74+
}
75+
},
76+
{
77+
"$addFields": {
78+
"foo": 1
79+
}
80+
}
81+
]
82+
}
83+
}
84+
]
85+
},
86+
"expectResult": {
87+
"matchedCount": 1,
88+
"modifiedCount": 1,
89+
"upsertedCount": 0
90+
}
91+
}
92+
],
93+
"expectEvents": [
94+
{
95+
"client": "client0",
96+
"events": [
97+
{
98+
"commandStartedEvent": {
99+
"command": {
100+
"update": "test",
101+
"updates": [
102+
{
103+
"q": {
104+
"_id": 1
105+
},
106+
"u": [
107+
{
108+
"$replaceRoot": {
109+
"newRoot": "$t"
110+
}
111+
},
112+
{
113+
"$addFields": {
114+
"foo": 1
115+
}
116+
}
117+
],
118+
"multi": {
119+
"$$unsetOrMatches": false
120+
},
121+
"upsert": {
122+
"$$unsetOrMatches": false
123+
}
124+
}
125+
]
126+
},
127+
"commandName": "update",
128+
"databaseName": "crud-tests"
129+
}
130+
}
131+
]
132+
}
133+
],
134+
"outcome": [
135+
{
136+
"collectionName": "test",
137+
"databaseName": "crud-tests",
138+
"documents": [
139+
{
140+
"_id": 1,
141+
"u": {
142+
"v": 1
143+
},
144+
"foo": 1
145+
},
146+
{
147+
"_id": 2,
148+
"x": 2,
149+
"y": 1
150+
}
151+
]
152+
}
153+
]
154+
}
155+
]
156+
}

0 commit comments

Comments
 (0)