PHPLIB-533: Separate BulkWrite tests by operation

parent 8109cb7e
...@@ -32,7 +32,7 @@ ...@@ -32,7 +32,7 @@
"database_name": "crud-tests", "database_name": "crud-tests",
"tests": [ "tests": [
{ {
"description": "BulkWrite with arrayFilters", "description": "BulkWrite updateOne with arrayFilters",
"operations": [ "operations": [
{ {
"name": "bulkWrite", "name": "bulkWrite",
...@@ -53,7 +53,86 @@ ...@@ -53,7 +53,86 @@
} }
] ]
} }
}
],
"options": {
"ordered": true
}
},
"result": {
"deletedCount": 0,
"insertedCount": 0,
"insertedIds": {},
"matchedCount": 1,
"modifiedCount": 1,
"upsertedCount": 0,
"upsertedIds": {}
}
}
],
"expectations": [
{
"command_started_event": {
"command": {
"update": "test",
"updates": [
{
"q": {},
"u": {
"$set": {
"y.$[i].b": 2
}
}, },
"arrayFilters": [
{
"i.b": 3
}
]
}
],
"ordered": true
},
"command_name": "update",
"database_name": "crud-tests"
}
}
],
"outcome": {
"collection": {
"data": [
{
"_id": 1,
"y": [
{
"b": 2
},
{
"b": 1
}
]
},
{
"_id": 2,
"y": [
{
"b": 0
},
{
"b": 1
}
]
}
]
}
}
},
{
"description": "BulkWrite updateMany with arrayFilters",
"operations": [
{
"name": "bulkWrite",
"arguments": {
"requests": [
{ {
"name": "updateMany", "name": "updateMany",
"arguments": { "arguments": {
...@@ -79,8 +158,8 @@ ...@@ -79,8 +158,8 @@
"deletedCount": 0, "deletedCount": 0,
"insertedCount": 0, "insertedCount": 0,
"insertedIds": {}, "insertedIds": {},
"matchedCount": 3, "matchedCount": 2,
"modifiedCount": 3, "modifiedCount": 2,
"upsertedCount": 0, "upsertedCount": 0,
"upsertedIds": {} "upsertedIds": {}
} }
...@@ -92,19 +171,6 @@ ...@@ -92,19 +171,6 @@
"command": { "command": {
"update": "test", "update": "test",
"updates": [ "updates": [
{
"q": {},
"u": {
"$set": {
"y.$[i].b": 2
}
},
"arrayFilters": [
{
"i.b": 3
}
]
},
{ {
"q": {}, "q": {},
"u": { "u": {
...@@ -134,7 +200,7 @@ ...@@ -134,7 +200,7 @@
"_id": 1, "_id": 1,
"y": [ "y": [
{ {
"b": 2 "b": 3
}, },
{ {
"b": 2 "b": 2
......
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
"collection_name": "test_bulkwrite_update_hint", "collection_name": "test_bulkwrite_update_hint",
"tests": [ "tests": [
{ {
"description": "BulkWrite with update hints", "description": "BulkWrite updateOne with update hints",
"operations": [ "operations": [
{ {
"name": "bulkWrite", "name": "bulkWrite",
...@@ -60,32 +60,45 @@ ...@@ -60,32 +60,45 @@
"_id": 1 "_id": 1
} }
} }
}
],
"options": {
"ordered": true
}
}, },
{ "result": {
"name": "updateMany", "deletedCount": 0,
"arguments": { "insertedCount": 0,
"filter": { "insertedIds": {},
"_id": { "matchedCount": 2,
"$lt": 3 "modifiedCount": 2,
"upsertedCount": 0,
"upsertedIds": {}
}
} }
],
"expectations": [
{
"command_started_event": {
"command": {
"update": "test_bulkwrite_update_hint",
"updates": [
{
"q": {
"_id": 1
}, },
"update": { "u": {
"$inc": { "$inc": {
"x": 1 "x": 1
} }
}, },
"hint": "_id_" "hint": "_id_"
}
}, },
{ {
"name": "updateMany", "q": {
"arguments": { "_id": 1
"filter": {
"_id": {
"$lt": 3
}
}, },
"update": { "u": {
"$inc": { "$inc": {
"x": 1 "x": 1
} }
...@@ -94,27 +107,70 @@ ...@@ -94,27 +107,70 @@
"_id": 1 "_id": 1
} }
} }
],
"ordered": true
}
}
}
],
"outcome": {
"collection": {
"data": [
{
"_id": 1,
"x": 13
},
{
"_id": 2,
"x": 22
},
{
"_id": 3,
"x": 33
},
{
"_id": 4,
"x": 44
}
]
}
}
}, },
{ {
"name": "replaceOne", "description": "BulkWrite updateMany with update hints",
"operations": [
{
"name": "bulkWrite",
"arguments": {
"requests": [
{
"name": "updateMany",
"arguments": { "arguments": {
"filter": { "filter": {
"_id": 3 "_id": {
"$lt": 3
}
}, },
"replacement": { "update": {
"x": 333 "$inc": {
"x": 1
}
}, },
"hint": "_id_" "hint": "_id_"
} }
}, },
{ {
"name": "replaceOne", "name": "updateMany",
"arguments": { "arguments": {
"filter": { "filter": {
"_id": 4 "_id": {
"$lt": 3
}
}, },
"replacement": { "update": {
"x": 444 "$inc": {
"x": 1
}
}, },
"hint": { "hint": {
"_id": 1 "_id": 1
...@@ -130,8 +186,8 @@ ...@@ -130,8 +186,8 @@
"deletedCount": 0, "deletedCount": 0,
"insertedCount": 0, "insertedCount": 0,
"insertedIds": {}, "insertedIds": {},
"matchedCount": 8, "matchedCount": 4,
"modifiedCount": 8, "modifiedCount": 4,
"upsertedCount": 0, "upsertedCount": 0,
"upsertedIds": {} "upsertedIds": {}
} }
...@@ -145,58 +201,118 @@ ...@@ -145,58 +201,118 @@
"updates": [ "updates": [
{ {
"q": { "q": {
"_id": 1 "_id": {
"$lt": 3
}
}, },
"u": { "u": {
"$inc": { "$inc": {
"x": 1 "x": 1
} }
}, },
"multi": true,
"hint": "_id_" "hint": "_id_"
}, },
{ {
"q": { "q": {
"_id": 1 "_id": {
"$lt": 3
}
}, },
"u": { "u": {
"$inc": { "$inc": {
"x": 1 "x": 1
} }
}, },
"multi": true,
"hint": { "hint": {
"_id": 1 "_id": 1
} }
}
],
"ordered": true
}
}
}
],
"outcome": {
"collection": {
"data": [
{
"_id": 1,
"x": 13
}, },
{ {
"q": { "_id": 2,
"_id": { "x": 24
"$lt": 3
}
}, },
"u": { {
"$inc": { "_id": 3,
"x": 1 "x": 33
},
{
"_id": 4,
"x": 44
}
]
}
} }
}, },
"multi": true, {
"description": "BulkWrite replaceOne with update hints",
"operations": [
{
"name": "bulkWrite",
"arguments": {
"requests": [
{
"name": "replaceOne",
"arguments": {
"filter": {
"_id": 3
},
"replacement": {
"x": 333
},
"hint": "_id_" "hint": "_id_"
}
}, },
{ {
"q": { "name": "replaceOne",
"_id": { "arguments": {
"$lt": 3 "filter": {
} "_id": 4
}, },
"u": { "replacement": {
"$inc": { "x": 444
"x": 1
}
}, },
"multi": true,
"hint": { "hint": {
"_id": 1 "_id": 1
} }
}
}
],
"options": {
"ordered": true
}
}, },
"result": {
"deletedCount": 0,
"insertedCount": 0,
"insertedIds": {},
"matchedCount": 2,
"modifiedCount": 2,
"upsertedCount": 0,
"upsertedIds": {}
}
}
],
"expectations": [
{
"command_started_event": {
"command": {
"update": "test_bulkwrite_update_hint",
"updates": [
{ {
"q": { "q": {
"_id": 3 "_id": 3
...@@ -228,11 +344,11 @@ ...@@ -228,11 +344,11 @@
"data": [ "data": [
{ {
"_id": 1, "_id": 1,
"x": 15 "x": 11
}, },
{ {
"_id": 2, "_id": 2,
"x": 24 "x": 22
}, },
{ {
"_id": 3, "_id": 3,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment