131 lines
2.5 KiB
JSON
131 lines
2.5 KiB
JSON
{
|
|
"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
|
|
}
|
|
]
|
|
}
|
|
]
|
|
}
|
|
]
|
|
}
|