Skip to content

Commit c2856e3

Browse files
author
Divjot Arora
authored
GODRIVER-1508 Add hint option for delete helpers (#338)
1 parent 216a913 commit c2856e3

Some content is hidden

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

47 files changed

+3955
-7
lines changed
Lines changed: 150 additions & 0 deletions
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+
}
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
runOn:
2+
# Server versions >= 3.4.0 will return an error response for unrecognized
3+
# deleteOne options. These tests check that the driver will raise an error
4+
# if a hint is provided on a server version < 3.4.
5+
- { maxServerVersion: "3.3.99" }
6+
7+
data:
8+
- {_id: 1, x: 11}
9+
- {_id: 2, x: 22}
10+
- {_id: 3, x: 33}
11+
- {_id: 4, x: 44}
12+
13+
collection_name: &collection_name 'BulkWrite_delete_hint'
14+
15+
tests:
16+
-
17+
description: "BulkWrite deleteOne with hints unsupported (client-side error)"
18+
operations:
19+
-
20+
name: "bulkWrite"
21+
arguments:
22+
requests:
23+
-
24+
name: "deleteOne"
25+
arguments:
26+
filter: &deleteOne_filter1 { _id: 1 }
27+
hint: &hint_string "_id_"
28+
-
29+
name: "deleteOne"
30+
arguments:
31+
filter: &deleteOne_filter2 { _id: 2 }
32+
hint: &hint_doc { _id: 1 }
33+
options: { ordered: true }
34+
error: true
35+
expectations: []
36+
outcome: &outcome
37+
collection:
38+
data:
39+
- {_id: 1, x: 11 }
40+
- {_id: 2, x: 22 }
41+
- {_id: 3, x: 33 }
42+
- {_id: 4, x: 44 }
43+
-
44+
description: "BulkWrite deleteMany with hints unsupported (client-side error)"
45+
operations:
46+
-
47+
name: "bulkWrite"
48+
arguments:
49+
requests:
50+
-
51+
name: "deleteMany"
52+
arguments:
53+
filter: &deleteMany_filter1 { _id: { $lt: 3 } }
54+
hint: *hint_string
55+
-
56+
name: "deleteMany"
57+
arguments:
58+
filter: &deleteMany_filter2 { _id: { $gte: 4 } }
59+
hint: *hint_doc
60+
options: { ordered: true }
61+
error: true
62+
expectations: []
63+
outcome: *outcome

0 commit comments

Comments
 (0)