Skip to content

Commit 1a7f2ee

Browse files
authored
CXX-1853, CXX-1947, CXX-1912 pass hint to update and delete (#694)
1 parent b49ec57 commit 1a7f2ee

File tree

70 files changed

+6893
-181
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

70 files changed

+6893
-181
lines changed

data/crud/test_files.txt

+49-1
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,54 @@ v1/write/updateOne.json
3636
v2/aggregate-merge.json
3737
v2/aggregate-out-readConcern.json
3838
v2/bulkWrite-arrayFilters.json
39+
v2/bulkWrite-delete-hint-clientError.json
40+
v2/bulkWrite-delete-hint.json
41+
v2/bulkWrite-delete-hint-serverError.json
42+
v2/bulkWrite-update-hint-clientError.json
43+
v2/bulkWrite-update-hint.json
44+
v2/bulkWrite-update-hint-serverError.json
3945
v2/db-aggregate.json
46+
v2/deleteMany-hint-clientError.json
47+
v2/deleteMany-hint.json
48+
v2/deleteMany-hint-serverError.json
49+
v2/deleteOne-hint-clientError.json
50+
v2/deleteOne-hint.json
51+
v2/deleteOne-hint-serverError.json
52+
v2/findOneAndDelete-hint-clientError.json
53+
v2/findOneAndDelete-hint.json
54+
v2/findOneAndDelete-hint-serverError.json
55+
v2/findOneAndReplace-hint-clientError.json
56+
v2/findOneAndReplace-hint.json
57+
v2/findOneAndReplace-hint-serverError.json
58+
v2/findOneAndUpdate-hint-clientError.json
59+
v2/findOneAndUpdate-hint.json
60+
v2/findOneAndUpdate-hint-serverError.json
61+
v2/replaceOne-hint.json
62+
v2/unacknowledged-bulkWrite-delete-hint-clientError.json
63+
v2/unacknowledged-bulkWrite-delete-hint.json
64+
v2/unacknowledged-bulkWrite-update-hint-clientError.json
65+
v2/unacknowledged-bulkWrite-update-hint.json
66+
v2/unacknowledged-deleteMany-hint-clientError.json
67+
v2/unacknowledged-deleteMany-hint.json
68+
v2/unacknowledged-deleteOne-hint-clientError.json
69+
v2/unacknowledged-deleteOne-hint.json
70+
v2/unacknowledged-findOneAndDelete-hint-clientError.json
71+
v2/unacknowledged-findOneAndDelete-hint.json
72+
v2/unacknowledged-findOneAndReplace-hint-clientError.json
73+
v2/unacknowledged-findOneAndReplace-hint.json
74+
v2/unacknowledged-findOneAndUpdate-hint-clientError.json
75+
v2/unacknowledged-findOneAndUpdate-hint.json
76+
v2/unacknowledged-replaceOne-hint-clientError.json
77+
v2/unacknowledged-replaceOne-hint.json
78+
v2/unacknowledged-updateMany-hint-clientError.json
79+
v2/unacknowledged-updateMany-hint.json
80+
v2/unacknowledged-updateOne-hint-clientError.json
81+
v2/unacknowledged-updateOne-hint.json
82+
v2/updateMany-hint-clientError.json
83+
v2/updateMany-hint.json
84+
v2/updateMany-hint-serverError.json
85+
v2/updateOne-hint-clientError.json
86+
v2/updateOne-hint.json
87+
v2/updateOne-hint-serverError.json
4088
v2/find-allowdiskuse.json
41-
v2/updateWithPipelines.json
89+
v2/updateWithPipelines.json

data/crud/v2/bulkWrite-arrayFilters.json

+84-18
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
"database_name": "crud-tests",
3333
"tests": [
3434
{
35-
"description": "BulkWrite with arrayFilters",
35+
"description": "BulkWrite updateOne with arrayFilters",
3636
"operations": [
3737
{
3838
"name": "bulkWrite",
@@ -53,7 +53,86 @@
5353
}
5454
]
5555
}
56-
},
56+
}
57+
],
58+
"options": {
59+
"ordered": true
60+
}
61+
},
62+
"result": {
63+
"deletedCount": 0,
64+
"insertedCount": 0,
65+
"insertedIds": {},
66+
"matchedCount": 1,
67+
"modifiedCount": 1,
68+
"upsertedCount": 0,
69+
"upsertedIds": {}
70+
}
71+
}
72+
],
73+
"expectations": [
74+
{
75+
"command_started_event": {
76+
"command": {
77+
"update": "test",
78+
"updates": [
79+
{
80+
"q": {},
81+
"u": {
82+
"$set": {
83+
"y.$[i].b": 2
84+
}
85+
},
86+
"arrayFilters": [
87+
{
88+
"i.b": 3
89+
}
90+
]
91+
}
92+
],
93+
"ordered": true
94+
},
95+
"command_name": "update",
96+
"database_name": "crud-tests"
97+
}
98+
}
99+
],
100+
"outcome": {
101+
"collection": {
102+
"data": [
103+
{
104+
"_id": 1,
105+
"y": [
106+
{
107+
"b": 2
108+
},
109+
{
110+
"b": 1
111+
}
112+
]
113+
},
114+
{
115+
"_id": 2,
116+
"y": [
117+
{
118+
"b": 0
119+
},
120+
{
121+
"b": 1
122+
}
123+
]
124+
}
125+
]
126+
}
127+
}
128+
},
129+
{
130+
"description": "BulkWrite updateMany with arrayFilters",
131+
"operations": [
132+
{
133+
"name": "bulkWrite",
134+
"arguments": {
135+
"requests": [
57136
{
58137
"name": "updateMany",
59138
"arguments": {
@@ -79,8 +158,8 @@
79158
"deletedCount": 0,
80159
"insertedCount": 0,
81160
"insertedIds": {},
82-
"matchedCount": 3,
83-
"modifiedCount": 3,
161+
"matchedCount": 2,
162+
"modifiedCount": 2,
84163
"upsertedCount": 0,
85164
"upsertedIds": {}
86165
}
@@ -92,19 +171,6 @@
92171
"command": {
93172
"update": "test",
94173
"updates": [
95-
{
96-
"q": {},
97-
"u": {
98-
"$set": {
99-
"y.$[i].b": 2
100-
}
101-
},
102-
"arrayFilters": [
103-
{
104-
"i.b": 3
105-
}
106-
]
107-
},
108174
{
109175
"q": {},
110176
"u": {
@@ -134,7 +200,7 @@
134200
"_id": 1,
135201
"y": [
136202
{
137-
"b": 2
203+
"b": 3
138204
},
139205
{
140206
"b": 2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,150 @@
1+
{
2+
"runOn": [
3+
{
4+
"maxServerVersion": "3.3.99"
5+
}
6+
],
7+
"data": [
8+
{
9+
"_id": 1,
10+
"x": 11
11+
},
12+
{
13+
"_id": 2,
14+
"x": 22
15+
},
16+
{
17+
"_id": 3,
18+
"x": 33
19+
},
20+
{
21+
"_id": 4,
22+
"x": 44
23+
}
24+
],
25+
"collection_name": "BulkWrite_delete_hint",
26+
"tests": [
27+
{
28+
"description": "BulkWrite deleteOne with hints unsupported (client-side error)",
29+
"operations": [
30+
{
31+
"name": "bulkWrite",
32+
"arguments": {
33+
"requests": [
34+
{
35+
"name": "deleteOne",
36+
"arguments": {
37+
"filter": {
38+
"_id": 1
39+
},
40+
"hint": "_id_"
41+
}
42+
},
43+
{
44+
"name": "deleteOne",
45+
"arguments": {
46+
"filter": {
47+
"_id": 2
48+
},
49+
"hint": {
50+
"_id": 1
51+
}
52+
}
53+
}
54+
],
55+
"options": {
56+
"ordered": true
57+
}
58+
},
59+
"error": true
60+
}
61+
],
62+
"expectations": [],
63+
"outcome": {
64+
"collection": {
65+
"data": [
66+
{
67+
"_id": 1,
68+
"x": 11
69+
},
70+
{
71+
"_id": 2,
72+
"x": 22
73+
},
74+
{
75+
"_id": 3,
76+
"x": 33
77+
},
78+
{
79+
"_id": 4,
80+
"x": 44
81+
}
82+
]
83+
}
84+
}
85+
},
86+
{
87+
"description": "BulkWrite deleteMany with hints unsupported (client-side error)",
88+
"operations": [
89+
{
90+
"name": "bulkWrite",
91+
"arguments": {
92+
"requests": [
93+
{
94+
"name": "deleteMany",
95+
"arguments": {
96+
"filter": {
97+
"_id": {
98+
"$lt": 3
99+
}
100+
},
101+
"hint": "_id_"
102+
}
103+
},
104+
{
105+
"name": "deleteMany",
106+
"arguments": {
107+
"filter": {
108+
"_id": {
109+
"$gte": 4
110+
}
111+
},
112+
"hint": {
113+
"_id": 1
114+
}
115+
}
116+
}
117+
],
118+
"options": {
119+
"ordered": true
120+
}
121+
},
122+
"error": true
123+
}
124+
],
125+
"expectations": [],
126+
"outcome": {
127+
"collection": {
128+
"data": [
129+
{
130+
"_id": 1,
131+
"x": 11
132+
},
133+
{
134+
"_id": 2,
135+
"x": 22
136+
},
137+
{
138+
"_id": 3,
139+
"x": 33
140+
},
141+
{
142+
"_id": 4,
143+
"x": 44
144+
}
145+
]
146+
}
147+
}
148+
}
149+
]
150+
}

0 commit comments

Comments
 (0)