Skip to content

Commit 40e0957

Browse files
committed
Test multi-deletes in transactions
1 parent 31876d3 commit 40e0957

File tree

2 files changed

+78
-16
lines changed

2 files changed

+78
-16
lines changed

test/transactions/bulk.json

Lines changed: 35 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,14 @@
105105
}
106106
}
107107
},
108+
{
109+
"name": "insertOne",
110+
"arguments": {
111+
"document": {
112+
"_id": 7
113+
}
114+
}
115+
},
108116
{
109117
"name": "replaceOne",
110118
"arguments": {
@@ -142,18 +150,29 @@
142150
"_id": 4
143151
}
144152
}
153+
},
154+
{
155+
"name": "deleteMany",
156+
"arguments": {
157+
"filter": {
158+
"_id": {
159+
"$gte": 6
160+
}
161+
}
162+
}
145163
}
146164
],
147165
"session": "session0"
148166
},
149167
"result": {
150-
"deletedCount": 2,
168+
"deletedCount": 4,
151169
"insertedIds": {
152170
"0": 1,
153171
"3": 3,
154172
"4": 4,
155173
"5": 5,
156-
"6": 6
174+
"6": 6,
175+
"7": 7
157176
},
158177
"matchedCount": 3,
159178
"modifiedCount": 3,
@@ -302,6 +321,9 @@
302321
},
303322
{
304323
"_id": 6
324+
},
325+
{
326+
"_id": 7
305327
}
306328
],
307329
"ordered": true,
@@ -348,7 +370,7 @@
348370
"txnNumber": {
349371
"$numberLong": "1"
350372
},
351-
"stmtId": 9,
373+
"stmtId": 10,
352374
"autocommit": null,
353375
"writeConcern": null
354376
},
@@ -372,14 +394,22 @@
372394
"_id": 4
373395
},
374396
"limit": 1
397+
},
398+
{
399+
"q": {
400+
"_id": {
401+
"$gte": 6
402+
}
403+
},
404+
"limit": 0
375405
}
376406
],
377407
"ordered": true,
378408
"lsid": "session0",
379409
"txnNumber": {
380410
"$numberLong": "1"
381411
},
382-
"stmtId": 11,
412+
"stmtId": 12,
383413
"autocommit": null,
384414
"writeConcern": null
385415
},
@@ -395,7 +425,7 @@
395425
"txnNumber": {
396426
"$numberLong": "1"
397427
},
398-
"stmtId": 13,
428+
"stmtId": 15,
399429
"writeConcern": null
400430
},
401431
"command_name": "commitTransaction",
@@ -416,9 +446,6 @@
416446
},
417447
{
418448
"_id": 5
419-
},
420-
{
421-
"_id": 6
422449
}
423450
]
424451
}

test/transactions/delete.json

Lines changed: 43 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,20 @@
3838
"deletedCount": 1
3939
}
4040
},
41+
{
42+
"name": "deleteMany",
43+
"arguments": {
44+
"filter": {
45+
"_id": {
46+
"$lte": 3
47+
}
48+
},
49+
"session": "session0"
50+
},
51+
"result": {
52+
"deletedCount": 2
53+
}
54+
},
4155
{
4256
"name": "deleteOne",
4357
"arguments": {
@@ -86,6 +100,33 @@
86100
"database_name": "transaction-tests"
87101
}
88102
},
103+
{
104+
"command_started_event": {
105+
"command": {
106+
"delete": "test",
107+
"deletes": [
108+
{
109+
"q": {
110+
"_id": {
111+
"$lte": 3
112+
}
113+
},
114+
"limit": 0
115+
}
116+
],
117+
"ordered": true,
118+
"lsid": "session0",
119+
"txnNumber": {
120+
"$numberLong": "1"
121+
},
122+
"stmtId": 1,
123+
"autocommit": null,
124+
"writeConcern": null
125+
},
126+
"command_name": "delete",
127+
"database_name": "transaction-tests"
128+
}
129+
},
89130
{
90131
"command_started_event": {
91132
"command": {
@@ -103,7 +144,7 @@
103144
"txnNumber": {
104145
"$numberLong": "1"
105146
},
106-
"stmtId": 1,
147+
"stmtId": 2,
107148
"autocommit": null,
108149
"writeConcern": null
109150
},
@@ -119,7 +160,7 @@
119160
"txnNumber": {
120161
"$numberLong": "1"
121162
},
122-
"stmtId": 2,
163+
"stmtId": 3,
123164
"writeConcern": null
124165
},
125166
"command_name": "commitTransaction",
@@ -130,12 +171,6 @@
130171
"outcome": {
131172
"collection": {
132173
"data": [
133-
{
134-
"_id": 2
135-
},
136-
{
137-
"_id": 3
138-
},
139174
{
140175
"_id": 5
141176
}

0 commit comments

Comments
 (0)