PYTHON-4961 - Split updateWithPipelines.yml by operation (#2217)
This commit is contained in:
parent
e99818df08
commit
f77e1ac119
148
test/crud/unified/bulkWrite-updateMany-pipeline.json
Normal file
148
test/crud/unified/bulkWrite-updateMany-pipeline.json
Normal file
@ -0,0 +1,148 @@
|
||||
{
|
||||
"description": "bulkWrite-updateMany-pipeline",
|
||||
"schemaVersion": "1.0",
|
||||
"runOnRequirements": [
|
||||
{
|
||||
"minServerVersion": "4.1.11"
|
||||
}
|
||||
],
|
||||
"createEntities": [
|
||||
{
|
||||
"client": {
|
||||
"id": "client0",
|
||||
"observeEvents": [
|
||||
"commandStartedEvent"
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"database": {
|
||||
"id": "database0",
|
||||
"client": "client0",
|
||||
"databaseName": "crud-tests"
|
||||
}
|
||||
},
|
||||
{
|
||||
"collection": {
|
||||
"id": "collection0",
|
||||
"database": "database0",
|
||||
"collectionName": "test"
|
||||
}
|
||||
}
|
||||
],
|
||||
"initialData": [
|
||||
{
|
||||
"collectionName": "test",
|
||||
"databaseName": "crud-tests",
|
||||
"documents": [
|
||||
{
|
||||
"_id": 1,
|
||||
"x": 1,
|
||||
"y": 1,
|
||||
"t": {
|
||||
"u": {
|
||||
"v": 1
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"_id": 2,
|
||||
"x": 2,
|
||||
"y": 1
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"tests": [
|
||||
{
|
||||
"description": "UpdateMany in bulk write using pipelines",
|
||||
"operations": [
|
||||
{
|
||||
"object": "collection0",
|
||||
"name": "bulkWrite",
|
||||
"arguments": {
|
||||
"requests": [
|
||||
{
|
||||
"updateMany": {
|
||||
"filter": {},
|
||||
"update": [
|
||||
{
|
||||
"$project": {
|
||||
"x": 1
|
||||
}
|
||||
},
|
||||
{
|
||||
"$addFields": {
|
||||
"foo": 1
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"expectResult": {
|
||||
"matchedCount": 2,
|
||||
"modifiedCount": 2,
|
||||
"upsertedCount": 0
|
||||
}
|
||||
}
|
||||
],
|
||||
"expectEvents": [
|
||||
{
|
||||
"client": "client0",
|
||||
"events": [
|
||||
{
|
||||
"commandStartedEvent": {
|
||||
"command": {
|
||||
"update": "test",
|
||||
"updates": [
|
||||
{
|
||||
"q": {},
|
||||
"u": [
|
||||
{
|
||||
"$project": {
|
||||
"x": 1
|
||||
}
|
||||
},
|
||||
{
|
||||
"$addFields": {
|
||||
"foo": 1
|
||||
}
|
||||
}
|
||||
],
|
||||
"multi": true,
|
||||
"upsert": {
|
||||
"$$unsetOrMatches": false
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"commandName": "update",
|
||||
"databaseName": "crud-tests"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"outcome": [
|
||||
{
|
||||
"collectionName": "test",
|
||||
"databaseName": "crud-tests",
|
||||
"documents": [
|
||||
{
|
||||
"_id": 1,
|
||||
"x": 1,
|
||||
"foo": 1
|
||||
},
|
||||
{
|
||||
"_id": 2,
|
||||
"x": 2,
|
||||
"foo": 1
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
156
test/crud/unified/bulkWrite-updateOne-pipeline.json
Normal file
156
test/crud/unified/bulkWrite-updateOne-pipeline.json
Normal file
@ -0,0 +1,156 @@
|
||||
{
|
||||
"description": "bulkWrite-updateOne-pipeline",
|
||||
"schemaVersion": "1.0",
|
||||
"runOnRequirements": [
|
||||
{
|
||||
"minServerVersion": "4.1.11"
|
||||
}
|
||||
],
|
||||
"createEntities": [
|
||||
{
|
||||
"client": {
|
||||
"id": "client0",
|
||||
"observeEvents": [
|
||||
"commandStartedEvent"
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"database": {
|
||||
"id": "database0",
|
||||
"client": "client0",
|
||||
"databaseName": "crud-tests"
|
||||
}
|
||||
},
|
||||
{
|
||||
"collection": {
|
||||
"id": "collection0",
|
||||
"database": "database0",
|
||||
"collectionName": "test"
|
||||
}
|
||||
}
|
||||
],
|
||||
"initialData": [
|
||||
{
|
||||
"collectionName": "test",
|
||||
"databaseName": "crud-tests",
|
||||
"documents": [
|
||||
{
|
||||
"_id": 1,
|
||||
"x": 1,
|
||||
"y": 1,
|
||||
"t": {
|
||||
"u": {
|
||||
"v": 1
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"_id": 2,
|
||||
"x": 2,
|
||||
"y": 1
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"tests": [
|
||||
{
|
||||
"description": "UpdateOne in bulk write using pipelines",
|
||||
"operations": [
|
||||
{
|
||||
"object": "collection0",
|
||||
"name": "bulkWrite",
|
||||
"arguments": {
|
||||
"requests": [
|
||||
{
|
||||
"updateOne": {
|
||||
"filter": {
|
||||
"_id": 1
|
||||
},
|
||||
"update": [
|
||||
{
|
||||
"$replaceRoot": {
|
||||
"newRoot": "$t"
|
||||
}
|
||||
},
|
||||
{
|
||||
"$addFields": {
|
||||
"foo": 1
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"expectResult": {
|
||||
"matchedCount": 1,
|
||||
"modifiedCount": 1,
|
||||
"upsertedCount": 0
|
||||
}
|
||||
}
|
||||
],
|
||||
"expectEvents": [
|
||||
{
|
||||
"client": "client0",
|
||||
"events": [
|
||||
{
|
||||
"commandStartedEvent": {
|
||||
"command": {
|
||||
"update": "test",
|
||||
"updates": [
|
||||
{
|
||||
"q": {
|
||||
"_id": 1
|
||||
},
|
||||
"u": [
|
||||
{
|
||||
"$replaceRoot": {
|
||||
"newRoot": "$t"
|
||||
}
|
||||
},
|
||||
{
|
||||
"$addFields": {
|
||||
"foo": 1
|
||||
}
|
||||
}
|
||||
],
|
||||
"multi": {
|
||||
"$$unsetOrMatches": false
|
||||
},
|
||||
"upsert": {
|
||||
"$$unsetOrMatches": false
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"commandName": "update",
|
||||
"databaseName": "crud-tests"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"outcome": [
|
||||
{
|
||||
"collectionName": "test",
|
||||
"databaseName": "crud-tests",
|
||||
"documents": [
|
||||
{
|
||||
"_id": 1,
|
||||
"u": {
|
||||
"v": 1
|
||||
},
|
||||
"foo": 1
|
||||
},
|
||||
{
|
||||
"_id": 2,
|
||||
"x": 2,
|
||||
"y": 1
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
130
test/crud/unified/findOneAndUpdate-pipeline.json
Normal file
130
test/crud/unified/findOneAndUpdate-pipeline.json
Normal file
@ -0,0 +1,130 @@
|
||||
{
|
||||
"description": "findOneAndUpdate-pipeline",
|
||||
"schemaVersion": "1.0",
|
||||
"runOnRequirements": [
|
||||
{
|
||||
"minServerVersion": "4.1.11"
|
||||
}
|
||||
],
|
||||
"createEntities": [
|
||||
{
|
||||
"client": {
|
||||
"id": "client0",
|
||||
"observeEvents": [
|
||||
"commandStartedEvent"
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"database": {
|
||||
"id": "database0",
|
||||
"client": "client0",
|
||||
"databaseName": "crud-tests"
|
||||
}
|
||||
},
|
||||
{
|
||||
"collection": {
|
||||
"id": "collection0",
|
||||
"database": "database0",
|
||||
"collectionName": "test"
|
||||
}
|
||||
}
|
||||
],
|
||||
"initialData": [
|
||||
{
|
||||
"collectionName": "test",
|
||||
"databaseName": "crud-tests",
|
||||
"documents": [
|
||||
{
|
||||
"_id": 1,
|
||||
"x": 1,
|
||||
"y": 1,
|
||||
"t": {
|
||||
"u": {
|
||||
"v": 1
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"_id": 2,
|
||||
"x": 2,
|
||||
"y": 1
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"tests": [
|
||||
{
|
||||
"description": "FindOneAndUpdate using pipelines",
|
||||
"operations": [
|
||||
{
|
||||
"object": "collection0",
|
||||
"name": "findOneAndUpdate",
|
||||
"arguments": {
|
||||
"filter": {
|
||||
"_id": 1
|
||||
},
|
||||
"update": [
|
||||
{
|
||||
"$project": {
|
||||
"x": 1
|
||||
}
|
||||
},
|
||||
{
|
||||
"$addFields": {
|
||||
"foo": 1
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
],
|
||||
"expectEvents": [
|
||||
{
|
||||
"client": "client0",
|
||||
"events": [
|
||||
{
|
||||
"commandStartedEvent": {
|
||||
"command": {
|
||||
"findAndModify": "test",
|
||||
"update": [
|
||||
{
|
||||
"$project": {
|
||||
"x": 1
|
||||
}
|
||||
},
|
||||
{
|
||||
"$addFields": {
|
||||
"foo": 1
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"commandName": "findAndModify",
|
||||
"databaseName": "crud-tests"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"outcome": [
|
||||
{
|
||||
"collectionName": "test",
|
||||
"databaseName": "crud-tests",
|
||||
"documents": [
|
||||
{
|
||||
"_id": 1,
|
||||
"x": 1,
|
||||
"foo": 1
|
||||
},
|
||||
{
|
||||
"_id": 2,
|
||||
"x": 2,
|
||||
"y": 1
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
142
test/crud/unified/updateMany-pipeline.json
Normal file
142
test/crud/unified/updateMany-pipeline.json
Normal file
@ -0,0 +1,142 @@
|
||||
{
|
||||
"description": "updateMany-pipeline",
|
||||
"schemaVersion": "1.0",
|
||||
"runOnRequirements": [
|
||||
{
|
||||
"minServerVersion": "4.1.11"
|
||||
}
|
||||
],
|
||||
"createEntities": [
|
||||
{
|
||||
"client": {
|
||||
"id": "client0",
|
||||
"observeEvents": [
|
||||
"commandStartedEvent"
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"database": {
|
||||
"id": "database0",
|
||||
"client": "client0",
|
||||
"databaseName": "crud-tests"
|
||||
}
|
||||
},
|
||||
{
|
||||
"collection": {
|
||||
"id": "collection0",
|
||||
"database": "database0",
|
||||
"collectionName": "test"
|
||||
}
|
||||
}
|
||||
],
|
||||
"initialData": [
|
||||
{
|
||||
"collectionName": "test",
|
||||
"databaseName": "crud-tests",
|
||||
"documents": [
|
||||
{
|
||||
"_id": 1,
|
||||
"x": 1,
|
||||
"y": 1,
|
||||
"t": {
|
||||
"u": {
|
||||
"v": 1
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"_id": 2,
|
||||
"x": 2,
|
||||
"y": 1
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"tests": [
|
||||
{
|
||||
"description": "UpdateMany using pipelines",
|
||||
"operations": [
|
||||
{
|
||||
"object": "collection0",
|
||||
"name": "updateMany",
|
||||
"arguments": {
|
||||
"filter": {},
|
||||
"update": [
|
||||
{
|
||||
"$project": {
|
||||
"x": 1
|
||||
}
|
||||
},
|
||||
{
|
||||
"$addFields": {
|
||||
"foo": 1
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"expectResult": {
|
||||
"matchedCount": 2,
|
||||
"modifiedCount": 2,
|
||||
"upsertedCount": 0
|
||||
}
|
||||
}
|
||||
],
|
||||
"expectEvents": [
|
||||
{
|
||||
"client": "client0",
|
||||
"events": [
|
||||
{
|
||||
"commandStartedEvent": {
|
||||
"command": {
|
||||
"update": "test",
|
||||
"updates": [
|
||||
{
|
||||
"q": {},
|
||||
"u": [
|
||||
{
|
||||
"$project": {
|
||||
"x": 1
|
||||
}
|
||||
},
|
||||
{
|
||||
"$addFields": {
|
||||
"foo": 1
|
||||
}
|
||||
}
|
||||
],
|
||||
"multi": true,
|
||||
"upsert": {
|
||||
"$$unsetOrMatches": false
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"commandName": "update",
|
||||
"databaseName": "crud-tests"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"outcome": [
|
||||
{
|
||||
"collectionName": "test",
|
||||
"databaseName": "crud-tests",
|
||||
"documents": [
|
||||
{
|
||||
"_id": 1,
|
||||
"x": 1,
|
||||
"foo": 1
|
||||
},
|
||||
{
|
||||
"_id": 2,
|
||||
"x": 2,
|
||||
"foo": 1
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
150
test/crud/unified/updateOne-pipeline.json
Normal file
150
test/crud/unified/updateOne-pipeline.json
Normal file
@ -0,0 +1,150 @@
|
||||
{
|
||||
"description": "updateOne-pipeline",
|
||||
"schemaVersion": "1.0",
|
||||
"runOnRequirements": [
|
||||
{
|
||||
"minServerVersion": "4.1.11"
|
||||
}
|
||||
],
|
||||
"createEntities": [
|
||||
{
|
||||
"client": {
|
||||
"id": "client0",
|
||||
"observeEvents": [
|
||||
"commandStartedEvent"
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"database": {
|
||||
"id": "database0",
|
||||
"client": "client0",
|
||||
"databaseName": "crud-tests"
|
||||
}
|
||||
},
|
||||
{
|
||||
"collection": {
|
||||
"id": "collection0",
|
||||
"database": "database0",
|
||||
"collectionName": "test"
|
||||
}
|
||||
}
|
||||
],
|
||||
"initialData": [
|
||||
{
|
||||
"collectionName": "test",
|
||||
"databaseName": "crud-tests",
|
||||
"documents": [
|
||||
{
|
||||
"_id": 1,
|
||||
"x": 1,
|
||||
"y": 1,
|
||||
"t": {
|
||||
"u": {
|
||||
"v": 1
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"_id": 2,
|
||||
"x": 2,
|
||||
"y": 1
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"tests": [
|
||||
{
|
||||
"description": "UpdateOne using pipelines",
|
||||
"operations": [
|
||||
{
|
||||
"object": "collection0",
|
||||
"name": "updateOne",
|
||||
"arguments": {
|
||||
"filter": {
|
||||
"_id": 1
|
||||
},
|
||||
"update": [
|
||||
{
|
||||
"$replaceRoot": {
|
||||
"newRoot": "$t"
|
||||
}
|
||||
},
|
||||
{
|
||||
"$addFields": {
|
||||
"foo": 1
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"expectResult": {
|
||||
"matchedCount": 1,
|
||||
"modifiedCount": 1,
|
||||
"upsertedCount": 0
|
||||
}
|
||||
}
|
||||
],
|
||||
"expectEvents": [
|
||||
{
|
||||
"client": "client0",
|
||||
"events": [
|
||||
{
|
||||
"commandStartedEvent": {
|
||||
"command": {
|
||||
"update": "test",
|
||||
"updates": [
|
||||
{
|
||||
"q": {
|
||||
"_id": 1
|
||||
},
|
||||
"u": [
|
||||
{
|
||||
"$replaceRoot": {
|
||||
"newRoot": "$t"
|
||||
}
|
||||
},
|
||||
{
|
||||
"$addFields": {
|
||||
"foo": 1
|
||||
}
|
||||
}
|
||||
],
|
||||
"multi": {
|
||||
"$$unsetOrMatches": false
|
||||
},
|
||||
"upsert": {
|
||||
"$$unsetOrMatches": false
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"commandName": "update",
|
||||
"databaseName": "crud-tests"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"outcome": [
|
||||
{
|
||||
"collectionName": "test",
|
||||
"databaseName": "crud-tests",
|
||||
"documents": [
|
||||
{
|
||||
"_id": 1,
|
||||
"u": {
|
||||
"v": 1
|
||||
},
|
||||
"foo": 1
|
||||
},
|
||||
{
|
||||
"_id": 2,
|
||||
"x": 2,
|
||||
"y": 1
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
@ -1,494 +0,0 @@
|
||||
{
|
||||
"description": "updateWithPipelines",
|
||||
"schemaVersion": "1.0",
|
||||
"runOnRequirements": [
|
||||
{
|
||||
"minServerVersion": "4.1.11"
|
||||
}
|
||||
],
|
||||
"createEntities": [
|
||||
{
|
||||
"client": {
|
||||
"id": "client0",
|
||||
"observeEvents": [
|
||||
"commandStartedEvent"
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"database": {
|
||||
"id": "database0",
|
||||
"client": "client0",
|
||||
"databaseName": "crud-tests"
|
||||
}
|
||||
},
|
||||
{
|
||||
"collection": {
|
||||
"id": "collection0",
|
||||
"database": "database0",
|
||||
"collectionName": "test"
|
||||
}
|
||||
}
|
||||
],
|
||||
"initialData": [
|
||||
{
|
||||
"collectionName": "test",
|
||||
"databaseName": "crud-tests",
|
||||
"documents": [
|
||||
{
|
||||
"_id": 1,
|
||||
"x": 1,
|
||||
"y": 1,
|
||||
"t": {
|
||||
"u": {
|
||||
"v": 1
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"_id": 2,
|
||||
"x": 2,
|
||||
"y": 1
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"tests": [
|
||||
{
|
||||
"description": "UpdateOne using pipelines",
|
||||
"operations": [
|
||||
{
|
||||
"object": "collection0",
|
||||
"name": "updateOne",
|
||||
"arguments": {
|
||||
"filter": {
|
||||
"_id": 1
|
||||
},
|
||||
"update": [
|
||||
{
|
||||
"$replaceRoot": {
|
||||
"newRoot": "$t"
|
||||
}
|
||||
},
|
||||
{
|
||||
"$addFields": {
|
||||
"foo": 1
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"expectResult": {
|
||||
"matchedCount": 1,
|
||||
"modifiedCount": 1,
|
||||
"upsertedCount": 0
|
||||
}
|
||||
}
|
||||
],
|
||||
"expectEvents": [
|
||||
{
|
||||
"client": "client0",
|
||||
"events": [
|
||||
{
|
||||
"commandStartedEvent": {
|
||||
"command": {
|
||||
"update": "test",
|
||||
"updates": [
|
||||
{
|
||||
"q": {
|
||||
"_id": 1
|
||||
},
|
||||
"u": [
|
||||
{
|
||||
"$replaceRoot": {
|
||||
"newRoot": "$t"
|
||||
}
|
||||
},
|
||||
{
|
||||
"$addFields": {
|
||||
"foo": 1
|
||||
}
|
||||
}
|
||||
],
|
||||
"multi": {
|
||||
"$$unsetOrMatches": false
|
||||
},
|
||||
"upsert": {
|
||||
"$$unsetOrMatches": false
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"commandName": "update",
|
||||
"databaseName": "crud-tests"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"outcome": [
|
||||
{
|
||||
"collectionName": "test",
|
||||
"databaseName": "crud-tests",
|
||||
"documents": [
|
||||
{
|
||||
"_id": 1,
|
||||
"u": {
|
||||
"v": 1
|
||||
},
|
||||
"foo": 1
|
||||
},
|
||||
{
|
||||
"_id": 2,
|
||||
"x": 2,
|
||||
"y": 1
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "UpdateMany using pipelines",
|
||||
"operations": [
|
||||
{
|
||||
"object": "collection0",
|
||||
"name": "updateMany",
|
||||
"arguments": {
|
||||
"filter": {},
|
||||
"update": [
|
||||
{
|
||||
"$project": {
|
||||
"x": 1
|
||||
}
|
||||
},
|
||||
{
|
||||
"$addFields": {
|
||||
"foo": 1
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"expectResult": {
|
||||
"matchedCount": 2,
|
||||
"modifiedCount": 2,
|
||||
"upsertedCount": 0
|
||||
}
|
||||
}
|
||||
],
|
||||
"expectEvents": [
|
||||
{
|
||||
"client": "client0",
|
||||
"events": [
|
||||
{
|
||||
"commandStartedEvent": {
|
||||
"command": {
|
||||
"update": "test",
|
||||
"updates": [
|
||||
{
|
||||
"q": {},
|
||||
"u": [
|
||||
{
|
||||
"$project": {
|
||||
"x": 1
|
||||
}
|
||||
},
|
||||
{
|
||||
"$addFields": {
|
||||
"foo": 1
|
||||
}
|
||||
}
|
||||
],
|
||||
"multi": true,
|
||||
"upsert": {
|
||||
"$$unsetOrMatches": false
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"commandName": "update",
|
||||
"databaseName": "crud-tests"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"outcome": [
|
||||
{
|
||||
"collectionName": "test",
|
||||
"databaseName": "crud-tests",
|
||||
"documents": [
|
||||
{
|
||||
"_id": 1,
|
||||
"x": 1,
|
||||
"foo": 1
|
||||
},
|
||||
{
|
||||
"_id": 2,
|
||||
"x": 2,
|
||||
"foo": 1
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "FindOneAndUpdate using pipelines",
|
||||
"operations": [
|
||||
{
|
||||
"object": "collection0",
|
||||
"name": "findOneAndUpdate",
|
||||
"arguments": {
|
||||
"filter": {
|
||||
"_id": 1
|
||||
},
|
||||
"update": [
|
||||
{
|
||||
"$project": {
|
||||
"x": 1
|
||||
}
|
||||
},
|
||||
{
|
||||
"$addFields": {
|
||||
"foo": 1
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
],
|
||||
"expectEvents": [
|
||||
{
|
||||
"client": "client0",
|
||||
"events": [
|
||||
{
|
||||
"commandStartedEvent": {
|
||||
"command": {
|
||||
"findAndModify": "test",
|
||||
"update": [
|
||||
{
|
||||
"$project": {
|
||||
"x": 1
|
||||
}
|
||||
},
|
||||
{
|
||||
"$addFields": {
|
||||
"foo": 1
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"commandName": "findAndModify",
|
||||
"databaseName": "crud-tests"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"outcome": [
|
||||
{
|
||||
"collectionName": "test",
|
||||
"databaseName": "crud-tests",
|
||||
"documents": [
|
||||
{
|
||||
"_id": 1,
|
||||
"x": 1,
|
||||
"foo": 1
|
||||
},
|
||||
{
|
||||
"_id": 2,
|
||||
"x": 2,
|
||||
"y": 1
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "UpdateOne in bulk write using pipelines",
|
||||
"operations": [
|
||||
{
|
||||
"object": "collection0",
|
||||
"name": "bulkWrite",
|
||||
"arguments": {
|
||||
"requests": [
|
||||
{
|
||||
"updateOne": {
|
||||
"filter": {
|
||||
"_id": 1
|
||||
},
|
||||
"update": [
|
||||
{
|
||||
"$replaceRoot": {
|
||||
"newRoot": "$t"
|
||||
}
|
||||
},
|
||||
{
|
||||
"$addFields": {
|
||||
"foo": 1
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"expectResult": {
|
||||
"matchedCount": 1,
|
||||
"modifiedCount": 1,
|
||||
"upsertedCount": 0
|
||||
}
|
||||
}
|
||||
],
|
||||
"expectEvents": [
|
||||
{
|
||||
"client": "client0",
|
||||
"events": [
|
||||
{
|
||||
"commandStartedEvent": {
|
||||
"command": {
|
||||
"update": "test",
|
||||
"updates": [
|
||||
{
|
||||
"q": {
|
||||
"_id": 1
|
||||
},
|
||||
"u": [
|
||||
{
|
||||
"$replaceRoot": {
|
||||
"newRoot": "$t"
|
||||
}
|
||||
},
|
||||
{
|
||||
"$addFields": {
|
||||
"foo": 1
|
||||
}
|
||||
}
|
||||
],
|
||||
"multi": {
|
||||
"$$unsetOrMatches": false
|
||||
},
|
||||
"upsert": {
|
||||
"$$unsetOrMatches": false
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"commandName": "update",
|
||||
"databaseName": "crud-tests"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"outcome": [
|
||||
{
|
||||
"collectionName": "test",
|
||||
"databaseName": "crud-tests",
|
||||
"documents": [
|
||||
{
|
||||
"_id": 1,
|
||||
"u": {
|
||||
"v": 1
|
||||
},
|
||||
"foo": 1
|
||||
},
|
||||
{
|
||||
"_id": 2,
|
||||
"x": 2,
|
||||
"y": 1
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "UpdateMany in bulk write using pipelines",
|
||||
"operations": [
|
||||
{
|
||||
"object": "collection0",
|
||||
"name": "bulkWrite",
|
||||
"arguments": {
|
||||
"requests": [
|
||||
{
|
||||
"updateMany": {
|
||||
"filter": {},
|
||||
"update": [
|
||||
{
|
||||
"$project": {
|
||||
"x": 1
|
||||
}
|
||||
},
|
||||
{
|
||||
"$addFields": {
|
||||
"foo": 1
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"expectResult": {
|
||||
"matchedCount": 2,
|
||||
"modifiedCount": 2,
|
||||
"upsertedCount": 0
|
||||
}
|
||||
}
|
||||
],
|
||||
"expectEvents": [
|
||||
{
|
||||
"client": "client0",
|
||||
"events": [
|
||||
{
|
||||
"commandStartedEvent": {
|
||||
"command": {
|
||||
"update": "test",
|
||||
"updates": [
|
||||
{
|
||||
"q": {},
|
||||
"u": [
|
||||
{
|
||||
"$project": {
|
||||
"x": 1
|
||||
}
|
||||
},
|
||||
{
|
||||
"$addFields": {
|
||||
"foo": 1
|
||||
}
|
||||
}
|
||||
],
|
||||
"multi": true,
|
||||
"upsert": {
|
||||
"$$unsetOrMatches": false
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"commandName": "update",
|
||||
"databaseName": "crud-tests"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"outcome": [
|
||||
{
|
||||
"collectionName": "test",
|
||||
"databaseName": "crud-tests",
|
||||
"documents": [
|
||||
{
|
||||
"_id": 1,
|
||||
"x": 1,
|
||||
"foo": 1
|
||||
},
|
||||
{
|
||||
"_id": 2,
|
||||
"x": 2,
|
||||
"foo": 1
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user