mongo-python-driver/test/crud/unified/findOneAndDelete.json

172 lines
3.2 KiB
JSON

{
"description": "findOneAndDelete",
"schemaVersion": "1.0",
"createEntities": [
{
"client": {
"id": "client0"
}
},
{
"database": {
"id": "database0",
"client": "client0",
"databaseName": "crud-v1"
}
},
{
"collection": {
"id": "collection0",
"database": "database0",
"collectionName": "coll"
}
}
],
"initialData": [
{
"collectionName": "coll",
"databaseName": "crud-v1",
"documents": [
{
"_id": 1,
"x": 11
},
{
"_id": 2,
"x": 22
},
{
"_id": 3,
"x": 33
}
]
}
],
"tests": [
{
"description": "FindOneAndDelete when many documents match",
"operations": [
{
"object": "collection0",
"name": "findOneAndDelete",
"arguments": {
"filter": {
"_id": {
"$gt": 1
}
},
"projection": {
"x": 1,
"_id": 0
},
"sort": {
"x": 1
}
},
"expectResult": {
"x": 22
}
}
],
"outcome": [
{
"collectionName": "coll",
"databaseName": "crud-v1",
"documents": [
{
"_id": 1,
"x": 11
},
{
"_id": 3,
"x": 33
}
]
}
]
},
{
"description": "FindOneAndDelete when one document matches",
"operations": [
{
"object": "collection0",
"name": "findOneAndDelete",
"arguments": {
"filter": {
"_id": 2
},
"projection": {
"x": 1,
"_id": 0
},
"sort": {
"x": 1
}
},
"expectResult": {
"x": 22
}
}
],
"outcome": [
{
"collectionName": "coll",
"databaseName": "crud-v1",
"documents": [
{
"_id": 1,
"x": 11
},
{
"_id": 3,
"x": 33
}
]
}
]
},
{
"description": "FindOneAndDelete when no documents match",
"operations": [
{
"object": "collection0",
"name": "findOneAndDelete",
"arguments": {
"filter": {
"_id": 4
},
"projection": {
"x": 1,
"_id": 0
},
"sort": {
"x": 1
}
},
"expectResult": null
}
],
"outcome": [
{
"collectionName": "coll",
"databaseName": "crud-v1",
"documents": [
{
"_id": 1,
"x": 11
},
{
"_id": 2,
"x": 22
},
{
"_id": 3,
"x": 33
}
]
}
]
}
]
}