PYTHON-4245 Convert CRUD v1 spec tests to unified test format (#1751)

This commit is contained in:
Steven Silvester 2024-07-29 17:42:18 -05:00 committed by GitHub
parent af9cbda58d
commit 98658cfd1f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
70 changed files with 5950 additions and 4777 deletions

View File

@ -0,0 +1,73 @@
{
"description": "aggregate-collation",
"schemaVersion": "1.4",
"runOnRequirements": [
{
"minServerVersion": "3.4",
"serverless": "forbid"
}
],
"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": "ping"
}
]
}
],
"tests": [
{
"description": "Aggregate with collation",
"operations": [
{
"object": "collection0",
"name": "aggregate",
"arguments": {
"pipeline": [
{
"$match": {
"x": "PING"
}
}
],
"collation": {
"locale": "en_US",
"strength": 2
}
},
"expectResult": [
{
"_id": 1,
"x": "ping"
}
]
}
]
}
]
}

View File

@ -0,0 +1,143 @@
{
"description": "aggregate-out",
"schemaVersion": "1.4",
"runOnRequirements": [
{
"minServerVersion": "2.6",
"serverless": "forbid"
}
],
"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": "Aggregate with $out",
"operations": [
{
"object": "collection0",
"name": "aggregate",
"arguments": {
"pipeline": [
{
"$sort": {
"x": 1
}
},
{
"$match": {
"_id": {
"$gt": 1
}
}
},
{
"$out": "other_test_collection"
}
],
"batchSize": 2
}
}
],
"outcome": [
{
"collectionName": "other_test_collection",
"databaseName": "crud-v1",
"documents": [
{
"_id": 2,
"x": 22
},
{
"_id": 3,
"x": 33
}
]
}
]
},
{
"description": "Aggregate with $out and batch size of 0",
"operations": [
{
"object": "collection0",
"name": "aggregate",
"arguments": {
"pipeline": [
{
"$sort": {
"x": 1
}
},
{
"$match": {
"_id": {
"$gt": 1
}
}
},
{
"$out": "other_test_collection"
}
],
"batchSize": 0
}
}
],
"outcome": [
{
"collectionName": "other_test_collection",
"databaseName": "crud-v1",
"documents": [
{
"_id": 2,
"x": 22
},
{
"_id": 3,
"x": 33
}
]
}
]
}
]
}

View File

@ -562,6 +562,54 @@
]
}
]
},
{
"description": "Aggregate with multiple stages",
"operations": [
{
"object": "collection0",
"name": "aggregate",
"arguments": {
"pipeline": [
{
"$sort": {
"x": 1
}
},
{
"$match": {
"_id": {
"$gt": 1
}
}
}
],
"batchSize": 2
},
"expectResult": [
{
"_id": 2,
"x": 22
},
{
"_id": 3,
"x": 33
},
{
"_id": 4,
"x": 44
},
{
"_id": 5,
"x": 55
},
{
"_id": 6,
"x": 66
}
]
}
]
}
]
}

View File

@ -274,6 +274,91 @@
]
}
]
},
{
"description": "BulkWrite with arrayFilters",
"operations": [
{
"object": "collection0",
"name": "bulkWrite",
"arguments": {
"requests": [
{
"updateOne": {
"filter": {},
"update": {
"$set": {
"y.$[i].b": 2
}
},
"arrayFilters": [
{
"i.b": 3
}
]
}
},
{
"updateMany": {
"filter": {},
"update": {
"$set": {
"y.$[i].b": 2
}
},
"arrayFilters": [
{
"i.b": 1
}
]
}
}
],
"ordered": true
},
"expectResult": {
"deletedCount": 0,
"insertedCount": 0,
"insertedIds": {
"$$unsetOrMatches": {}
},
"matchedCount": 3,
"modifiedCount": 3,
"upsertedCount": 0,
"upsertedIds": {}
}
}
],
"outcome": [
{
"collectionName": "test",
"databaseName": "crud-tests",
"documents": [
{
"_id": 1,
"y": [
{
"b": 2
},
{
"b": 2
}
]
},
{
"_id": 2,
"y": [
{
"b": 0
},
{
"b": 2
}
]
}
]
}
]
}
]
}

View File

@ -0,0 +1,254 @@
{
"description": "bulkWrite-collation",
"schemaVersion": "1.4",
"runOnRequirements": [
{
"minServerVersion": "3.4",
"serverless": "forbid"
}
],
"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": "ping"
},
{
"_id": 3,
"x": "pINg"
},
{
"_id": 4,
"x": "pong"
},
{
"_id": 5,
"x": "pONg"
}
]
}
],
"tests": [
{
"description": "BulkWrite with delete operations and collation",
"operations": [
{
"object": "collection0",
"name": "bulkWrite",
"arguments": {
"requests": [
{
"deleteOne": {
"filter": {
"x": "PING"
},
"collation": {
"locale": "en_US",
"strength": 2
}
}
},
{
"deleteOne": {
"filter": {
"x": "PING"
},
"collation": {
"locale": "en_US",
"strength": 2
}
}
},
{
"deleteMany": {
"filter": {
"x": "PONG"
},
"collation": {
"locale": "en_US",
"strength": 2
}
}
}
],
"ordered": true
},
"expectResult": {
"deletedCount": 4,
"insertedCount": 0,
"insertedIds": {
"$$unsetOrMatches": {}
},
"matchedCount": 0,
"modifiedCount": 0,
"upsertedCount": 0,
"upsertedIds": {}
}
}
],
"outcome": [
{
"collectionName": "coll",
"databaseName": "crud-v1",
"documents": [
{
"_id": 1,
"x": 11
}
]
}
]
},
{
"description": "BulkWrite with update operations and collation",
"operations": [
{
"object": "collection0",
"name": "bulkWrite",
"arguments": {
"requests": [
{
"updateMany": {
"filter": {
"x": "ping"
},
"update": {
"$set": {
"x": "PONG"
}
},
"collation": {
"locale": "en_US",
"strength": 3
}
}
},
{
"updateOne": {
"filter": {
"x": "ping"
},
"update": {
"$set": {
"x": "PONG"
}
},
"collation": {
"locale": "en_US",
"strength": 2
}
}
},
{
"replaceOne": {
"filter": {
"x": "ping"
},
"replacement": {
"_id": 6,
"x": "ping"
},
"upsert": true,
"collation": {
"locale": "en_US",
"strength": 3
}
}
},
{
"updateMany": {
"filter": {
"x": "pong"
},
"update": {
"$set": {
"x": "PONG"
}
},
"collation": {
"locale": "en_US",
"strength": 2
}
}
}
],
"ordered": true
},
"expectResult": {
"deletedCount": 0,
"insertedCount": 0,
"insertedIds": {
"$$unsetOrMatches": {}
},
"matchedCount": 6,
"modifiedCount": 4,
"upsertedCount": 1,
"upsertedIds": {
"2": 6
}
}
}
],
"outcome": [
{
"collectionName": "coll",
"databaseName": "crud-v1",
"documents": [
{
"_id": 1,
"x": 11
},
{
"_id": 2,
"x": "PONG"
},
{
"_id": 3,
"x": "PONG"
},
{
"_id": 4,
"x": "PONG"
},
{
"_id": 5,
"x": "PONG"
},
{
"_id": 6,
"x": "ping"
}
]
}
]
}
]
}

View File

@ -0,0 +1,829 @@
{
"description": "bulkWrite",
"schemaVersion": "1.0",
"runOnRequirements": [
{
"minServerVersion": "2.6"
}
],
"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
}
]
}
],
"tests": [
{
"description": "BulkWrite with deleteOne operations",
"operations": [
{
"object": "collection0",
"name": "bulkWrite",
"arguments": {
"requests": [
{
"deleteOne": {
"filter": {
"_id": 3
}
}
},
{
"deleteOne": {
"filter": {
"_id": 2
}
}
}
],
"ordered": true
},
"expectResult": {
"deletedCount": 1,
"insertedCount": 0,
"insertedIds": {
"$$unsetOrMatches": {}
},
"matchedCount": 0,
"modifiedCount": 0,
"upsertedCount": 0,
"upsertedIds": {}
}
}
],
"outcome": [
{
"collectionName": "coll",
"databaseName": "crud-v1",
"documents": [
{
"_id": 1,
"x": 11
}
]
}
]
},
{
"description": "BulkWrite with deleteMany operations",
"operations": [
{
"object": "collection0",
"name": "bulkWrite",
"arguments": {
"requests": [
{
"deleteMany": {
"filter": {
"x": {
"$lt": 11
}
}
}
},
{
"deleteMany": {
"filter": {
"x": {
"$lte": 22
}
}
}
}
],
"ordered": true
},
"expectResult": {
"deletedCount": 2,
"insertedCount": 0,
"insertedIds": {
"$$unsetOrMatches": {}
},
"matchedCount": 0,
"modifiedCount": 0,
"upsertedCount": 0,
"upsertedIds": {}
}
}
],
"outcome": [
{
"collectionName": "coll",
"databaseName": "crud-v1",
"documents": []
}
]
},
{
"description": "BulkWrite with insertOne operations",
"operations": [
{
"object": "collection0",
"name": "bulkWrite",
"arguments": {
"requests": [
{
"insertOne": {
"document": {
"_id": 3,
"x": 33
}
}
},
{
"insertOne": {
"document": {
"_id": 4,
"x": 44
}
}
}
],
"ordered": true
},
"expectResult": {
"deletedCount": 0,
"insertedCount": 2,
"insertedIds": {
"$$unsetOrMatches": {
"0": 3,
"1": 4
}
},
"matchedCount": 0,
"modifiedCount": 0,
"upsertedCount": 0,
"upsertedIds": {}
}
}
],
"outcome": [
{
"collectionName": "coll",
"databaseName": "crud-v1",
"documents": [
{
"_id": 1,
"x": 11
},
{
"_id": 2,
"x": 22
},
{
"_id": 3,
"x": 33
},
{
"_id": 4,
"x": 44
}
]
}
]
},
{
"description": "BulkWrite with replaceOne operations",
"operations": [
{
"object": "collection0",
"name": "bulkWrite",
"arguments": {
"requests": [
{
"replaceOne": {
"filter": {
"_id": 3
},
"replacement": {
"x": 33
}
}
},
{
"replaceOne": {
"filter": {
"_id": 1
},
"replacement": {
"x": 12
}
}
},
{
"replaceOne": {
"filter": {
"_id": 3
},
"replacement": {
"x": 33
},
"upsert": true
}
}
],
"ordered": true
},
"expectResult": {
"deletedCount": 0,
"insertedCount": 0,
"insertedIds": {
"$$unsetOrMatches": {}
},
"matchedCount": 1,
"modifiedCount": 1,
"upsertedCount": 1,
"upsertedIds": {
"2": 3
}
}
}
],
"outcome": [
{
"collectionName": "coll",
"databaseName": "crud-v1",
"documents": [
{
"_id": 1,
"x": 12
},
{
"_id": 2,
"x": 22
},
{
"_id": 3,
"x": 33
}
]
}
]
},
{
"description": "BulkWrite with updateOne operations",
"operations": [
{
"object": "collection0",
"name": "bulkWrite",
"arguments": {
"requests": [
{
"updateOne": {
"filter": {
"_id": 0
},
"update": {
"$set": {
"x": 0
}
}
}
},
{
"updateOne": {
"filter": {
"_id": 1
},
"update": {
"$set": {
"x": 11
}
}
}
},
{
"updateOne": {
"filter": {
"_id": 2
},
"update": {
"$inc": {
"x": 1
}
}
}
},
{
"updateOne": {
"filter": {
"_id": 3
},
"update": {
"$set": {
"x": 33
}
},
"upsert": true
}
}
],
"ordered": true
},
"expectResult": {
"deletedCount": 0,
"insertedCount": 0,
"insertedIds": {
"$$unsetOrMatches": {}
},
"matchedCount": 2,
"modifiedCount": 1,
"upsertedCount": 1,
"upsertedIds": {
"3": 3
}
}
}
],
"outcome": [
{
"collectionName": "coll",
"databaseName": "crud-v1",
"documents": [
{
"_id": 1,
"x": 11
},
{
"_id": 2,
"x": 23
},
{
"_id": 3,
"x": 33
}
]
}
]
},
{
"description": "BulkWrite with updateMany operations",
"operations": [
{
"object": "collection0",
"name": "bulkWrite",
"arguments": {
"requests": [
{
"updateMany": {
"filter": {
"x": {
"$lt": 11
}
},
"update": {
"$set": {
"x": 0
}
}
}
},
{
"updateMany": {
"filter": {
"x": {
"$lte": 22
}
},
"update": {
"$unset": {
"y": 1
}
}
}
},
{
"updateMany": {
"filter": {
"x": {
"$lte": 22
}
},
"update": {
"$inc": {
"x": 1
}
}
}
},
{
"updateMany": {
"filter": {
"_id": 3
},
"update": {
"$set": {
"x": 33
}
},
"upsert": true
}
}
],
"ordered": true
},
"expectResult": {
"deletedCount": 0,
"insertedCount": 0,
"insertedIds": {
"$$unsetOrMatches": {}
},
"matchedCount": 4,
"modifiedCount": 2,
"upsertedCount": 1,
"upsertedIds": {
"3": 3
}
}
}
],
"outcome": [
{
"collectionName": "coll",
"databaseName": "crud-v1",
"documents": [
{
"_id": 1,
"x": 12
},
{
"_id": 2,
"x": 23
},
{
"_id": 3,
"x": 33
}
]
}
]
},
{
"description": "BulkWrite with mixed ordered operations",
"operations": [
{
"object": "collection0",
"name": "bulkWrite",
"arguments": {
"requests": [
{
"insertOne": {
"document": {
"_id": 3,
"x": 33
}
}
},
{
"updateOne": {
"filter": {
"_id": 2
},
"update": {
"$inc": {
"x": 1
}
}
}
},
{
"updateMany": {
"filter": {
"_id": {
"$gt": 1
}
},
"update": {
"$inc": {
"x": 1
}
}
}
},
{
"insertOne": {
"document": {
"_id": 4,
"x": 44
}
}
},
{
"deleteMany": {
"filter": {
"x": {
"$nin": [
24,
34
]
}
}
}
},
{
"replaceOne": {
"filter": {
"_id": 4
},
"replacement": {
"_id": 4,
"x": 44
},
"upsert": true
}
}
],
"ordered": true
},
"expectResult": {
"deletedCount": 2,
"insertedCount": 2,
"insertedIds": {
"$$unsetOrMatches": {
"0": 3,
"3": 4
}
},
"matchedCount": 3,
"modifiedCount": 3,
"upsertedCount": 1,
"upsertedIds": {
"5": 4
}
}
}
],
"outcome": [
{
"collectionName": "coll",
"databaseName": "crud-v1",
"documents": [
{
"_id": 2,
"x": 24
},
{
"_id": 3,
"x": 34
},
{
"_id": 4,
"x": 44
}
]
}
]
},
{
"description": "BulkWrite with mixed unordered operations",
"operations": [
{
"object": "collection0",
"name": "bulkWrite",
"arguments": {
"requests": [
{
"replaceOne": {
"filter": {
"_id": 3
},
"replacement": {
"_id": 3,
"x": 33
},
"upsert": true
}
},
{
"deleteOne": {
"filter": {
"_id": 1
}
}
},
{
"updateOne": {
"filter": {
"_id": 2
},
"update": {
"$inc": {
"x": 1
}
}
}
}
],
"ordered": false
},
"expectResult": {
"deletedCount": 1,
"insertedCount": 0,
"insertedIds": {
"$$unsetOrMatches": {}
},
"matchedCount": 1,
"modifiedCount": 1,
"upsertedCount": 1,
"upsertedIds": {
"0": 3
}
}
}
],
"outcome": [
{
"collectionName": "coll",
"databaseName": "crud-v1",
"documents": [
{
"_id": 2,
"x": 23
},
{
"_id": 3,
"x": 33
}
]
}
]
},
{
"description": "BulkWrite continue-on-error behavior with unordered (preexisting duplicate key)",
"operations": [
{
"object": "collection0",
"name": "bulkWrite",
"arguments": {
"requests": [
{
"insertOne": {
"document": {
"_id": 2,
"x": 22
}
}
},
{
"insertOne": {
"document": {
"_id": 3,
"x": 33
}
}
},
{
"insertOne": {
"document": {
"_id": 4,
"x": 44
}
}
}
],
"ordered": false
},
"expectError": {
"isError": true,
"expectResult": {
"deletedCount": 0,
"insertedCount": 2,
"matchedCount": 0,
"modifiedCount": 0,
"upsertedCount": 0,
"upsertedIds": {}
}
}
}
],
"outcome": [
{
"collectionName": "coll",
"databaseName": "crud-v1",
"documents": [
{
"_id": 1,
"x": 11
},
{
"_id": 2,
"x": 22
},
{
"_id": 3,
"x": 33
},
{
"_id": 4,
"x": 44
}
]
}
]
},
{
"description": "BulkWrite continue-on-error behavior with unordered (duplicate key in requests)",
"operations": [
{
"object": "collection0",
"name": "bulkWrite",
"arguments": {
"requests": [
{
"insertOne": {
"document": {
"_id": 3,
"x": 33
}
}
},
{
"insertOne": {
"document": {
"_id": 3,
"x": 33
}
}
},
{
"insertOne": {
"document": {
"_id": 4,
"x": 44
}
}
}
],
"ordered": false
},
"expectError": {
"isError": true,
"expectResult": {
"deletedCount": 0,
"insertedCount": 2,
"matchedCount": 0,
"modifiedCount": 0,
"upsertedCount": 0,
"upsertedIds": {}
}
}
}
],
"outcome": [
{
"collectionName": "coll",
"databaseName": "crud-v1",
"documents": [
{
"_id": 1,
"x": 11
},
{
"_id": 2,
"x": 22
},
{
"_id": 3,
"x": 33
},
{
"_id": 4,
"x": 44
}
]
}
]
}
]
}

View File

@ -0,0 +1,83 @@
{
"description": "count-collation",
"schemaVersion": "1.4",
"runOnRequirements": [
{
"minServerVersion": "3.4",
"serverless": "forbid"
}
],
"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": "ping"
}
]
}
],
"tests": [
{
"description": "Count documents with collation",
"operations": [
{
"object": "collection0",
"name": "countDocuments",
"arguments": {
"filter": {
"x": "ping"
},
"collation": {
"locale": "en_US",
"strength": 2
}
},
"expectResult": 1
}
]
},
{
"description": "Deprecated count with collation",
"operations": [
{
"object": "collection0",
"name": "count",
"arguments": {
"filter": {
"x": "ping"
},
"collation": {
"locale": "en_US",
"strength": 2
}
},
"expectResult": 1
}
]
}
]
}

View File

@ -0,0 +1,71 @@
{
"description": "count-empty",
"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": []
}
],
"tests": [
{
"description": "Estimated document count with empty collection",
"operations": [
{
"object": "collection0",
"name": "estimatedDocumentCount",
"arguments": {},
"expectResult": 0
}
]
},
{
"description": "Count documents with empty collection",
"operations": [
{
"object": "collection0",
"name": "countDocuments",
"arguments": {
"filter": {}
},
"expectResult": 0
}
]
},
{
"description": "Deprecated count with empty collection",
"operations": [
{
"object": "collection0",
"name": "count",
"arguments": {
"filter": {}
},
"expectResult": 0
}
]
}
]
}

View File

@ -0,0 +1,148 @@
{
"description": "count",
"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": "Estimated document count",
"operations": [
{
"object": "collection0",
"name": "estimatedDocumentCount",
"arguments": {},
"expectResult": 3
}
]
},
{
"description": "Count documents without a filter",
"operations": [
{
"object": "collection0",
"name": "countDocuments",
"arguments": {
"filter": {}
},
"expectResult": 3
}
]
},
{
"description": "Count documents with a filter",
"operations": [
{
"object": "collection0",
"name": "countDocuments",
"arguments": {
"filter": {
"_id": {
"$gt": 1
}
}
},
"expectResult": 2
}
]
},
{
"description": "Count documents with skip and limit",
"operations": [
{
"object": "collection0",
"name": "countDocuments",
"arguments": {
"filter": {},
"skip": 1,
"limit": 3
},
"expectResult": 2
}
]
},
{
"description": "Deprecated count without a filter",
"operations": [
{
"object": "collection0",
"name": "count",
"arguments": {
"filter": {}
},
"expectResult": 3
}
]
},
{
"description": "Deprecated count with a filter",
"operations": [
{
"object": "collection0",
"name": "count",
"arguments": {
"filter": {
"_id": {
"$gt": 1
}
}
},
"expectResult": 2
}
]
},
{
"description": "Deprecated count with skip and limit",
"operations": [
{
"object": "collection0",
"name": "count",
"arguments": {
"filter": {},
"skip": 1,
"limit": 3
},
"expectResult": 2
}
]
}
]
}

View File

@ -0,0 +1,86 @@
{
"description": "deleteMany-collation",
"schemaVersion": "1.4",
"runOnRequirements": [
{
"minServerVersion": "3.4",
"serverless": "forbid"
}
],
"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": "ping"
},
{
"_id": 3,
"x": "pINg"
}
]
}
],
"tests": [
{
"description": "DeleteMany when many documents match with collation",
"operations": [
{
"object": "collection0",
"name": "deleteMany",
"arguments": {
"filter": {
"x": "PING"
},
"collation": {
"locale": "en_US",
"strength": 2
}
},
"expectResult": {
"deletedCount": 2
}
}
],
"outcome": [
{
"collectionName": "coll",
"databaseName": "crud-v1",
"documents": [
{
"_id": 1,
"x": 11
}
]
}
]
}
]
}

View File

@ -0,0 +1,115 @@
{
"description": "deleteMany",
"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": "DeleteMany when many documents match",
"operations": [
{
"object": "collection0",
"name": "deleteMany",
"arguments": {
"filter": {
"_id": {
"$gt": 1
}
}
},
"expectResult": {
"deletedCount": 2
}
}
],
"outcome": [
{
"collectionName": "coll",
"databaseName": "crud-v1",
"documents": [
{
"_id": 1,
"x": 11
}
]
}
]
},
{
"description": "DeleteMany when no document matches",
"operations": [
{
"object": "collection0",
"name": "deleteMany",
"arguments": {
"filter": {
"_id": 4
}
},
"expectResult": {
"deletedCount": 0
}
}
],
"outcome": [
{
"collectionName": "coll",
"databaseName": "crud-v1",
"documents": [
{
"_id": 1,
"x": 11
},
{
"_id": 2,
"x": 22
},
{
"_id": 3,
"x": 33
}
]
}
]
}
]
}

View File

@ -0,0 +1,90 @@
{
"description": "deleteOne-collation",
"schemaVersion": "1.4",
"runOnRequirements": [
{
"minServerVersion": "3.4",
"serverless": "forbid"
}
],
"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": "ping"
},
{
"_id": 3,
"x": "pINg"
}
]
}
],
"tests": [
{
"description": "DeleteOne when many documents matches with collation",
"operations": [
{
"object": "collection0",
"name": "deleteOne",
"arguments": {
"filter": {
"x": "PING"
},
"collation": {
"locale": "en_US",
"strength": 2
}
},
"expectResult": {
"deletedCount": 1
}
}
],
"outcome": [
{
"collectionName": "coll",
"databaseName": "crud-v1",
"documents": [
{
"_id": 1,
"x": 11
},
{
"_id": 3,
"x": "pINg"
}
]
}
]
}
]
}

View File

@ -0,0 +1,136 @@
{
"description": "deleteOne",
"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": "DeleteOne when many documents match",
"operations": [
{
"object": "collection0",
"name": "deleteOne",
"arguments": {
"filter": {
"_id": {
"$gt": 1
}
}
},
"expectResult": {
"deletedCount": 1
}
}
]
},
{
"description": "DeleteOne when one document matches",
"operations": [
{
"object": "collection0",
"name": "deleteOne",
"arguments": {
"filter": {
"_id": 2
}
},
"expectResult": {
"deletedCount": 1
}
}
],
"outcome": [
{
"collectionName": "coll",
"databaseName": "crud-v1",
"documents": [
{
"_id": 1,
"x": 11
},
{
"_id": 3,
"x": 33
}
]
}
]
},
{
"description": "DeleteOne when no documents match",
"operations": [
{
"object": "collection0",
"name": "deleteOne",
"arguments": {
"filter": {
"_id": 4
}
},
"expectResult": {
"deletedCount": 0
}
}
],
"outcome": [
{
"collectionName": "coll",
"databaseName": "crud-v1",
"documents": [
{
"_id": 1,
"x": 11
},
{
"_id": 2,
"x": 22
},
{
"_id": 3,
"x": 33
}
]
}
]
}
]
}

View File

@ -0,0 +1,69 @@
{
"description": "distinct-collation",
"schemaVersion": "1.4",
"runOnRequirements": [
{
"minServerVersion": "3.4",
"serverless": "forbid"
}
],
"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,
"string": "PING"
},
{
"_id": 2,
"string": "ping"
}
]
}
],
"tests": [
{
"description": "Distinct with a collation",
"operations": [
{
"object": "collection0",
"name": "distinct",
"arguments": {
"fieldName": "string",
"filter": {},
"collation": {
"locale": "en_US",
"strength": 2
}
},
"expectResult": [
"PING"
]
}
]
}
]
}

View File

@ -0,0 +1,86 @@
{
"description": "distinct",
"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": "Distinct without a filter",
"operations": [
{
"object": "collection0",
"name": "distinct",
"arguments": {
"fieldName": "x",
"filter": {}
},
"expectResult": [
11,
22,
33
]
}
]
},
{
"description": "Distinct with a filter",
"operations": [
{
"object": "collection0",
"name": "distinct",
"arguments": {
"fieldName": "x",
"filter": {
"_id": {
"$gt": 1
}
}
},
"expectResult": [
22,
33
]
}
]
}
]
}

View File

@ -0,0 +1,69 @@
{
"description": "find-collation",
"schemaVersion": "1.4",
"runOnRequirements": [
{
"minServerVersion": "3.4",
"serverless": "forbid"
}
],
"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": "ping"
}
]
}
],
"tests": [
{
"description": "Find with a collation",
"operations": [
{
"object": "collection0",
"name": "find",
"arguments": {
"filter": {
"x": "PING"
},
"collation": {
"locale": "en_US",
"strength": 2
}
},
"expectResult": [
{
"_id": 1,
"x": "ping"
}
]
}
]
}
]
}

View File

@ -151,6 +151,92 @@
]
}
]
},
{
"description": "Find with filter",
"operations": [
{
"object": "collection0",
"name": "find",
"arguments": {
"filter": {
"_id": 1
}
},
"expectResult": [
{
"_id": 1,
"x": 11
}
]
}
]
},
{
"description": "Find with filter, sort, skip, and limit",
"operations": [
{
"object": "collection0",
"name": "find",
"arguments": {
"filter": {
"_id": {
"$gt": 2
}
},
"sort": {
"_id": 1
},
"skip": 2,
"limit": 2
},
"expectResult": [
{
"_id": 5,
"x": 55
},
{
"_id": 6,
"x": 66
}
]
}
]
},
{
"description": "Find with limit, sort, and batchsize",
"operations": [
{
"object": "collection0",
"name": "find",
"arguments": {
"filter": {},
"sort": {
"_id": 1
},
"limit": 4,
"batchSize": 2
},
"expectResult": [
{
"_id": 1,
"x": 11
},
{
"_id": 2,
"x": 22
},
{
"_id": 3,
"x": 33
},
{
"_id": 4,
"x": 44
}
]
}
]
}
]
}

View File

@ -0,0 +1,98 @@
{
"description": "findOneAndDelete-collation",
"schemaVersion": "1.4",
"runOnRequirements": [
{
"minServerVersion": "3.4",
"serverless": "forbid"
}
],
"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": "ping"
},
{
"_id": 3,
"x": "pINg"
}
]
}
],
"tests": [
{
"description": "FindOneAndDelete when one document matches with collation",
"operations": [
{
"object": "collection0",
"name": "findOneAndDelete",
"arguments": {
"filter": {
"_id": 2,
"x": "PING"
},
"projection": {
"x": 1,
"_id": 0
},
"sort": {
"x": 1
},
"collation": {
"locale": "en_US",
"strength": 2
}
},
"expectResult": {
"x": "ping"
}
}
],
"outcome": [
{
"collectionName": "coll",
"databaseName": "crud-v1",
"documents": [
{
"_id": 1,
"x": 11
},
{
"_id": 3,
"x": "pINg"
}
]
}
]
}
]
}

View File

@ -0,0 +1,171 @@
{
"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
}
]
}
]
}
]
}

View File

@ -0,0 +1,97 @@
{
"description": "findOneAndReplace-collation",
"schemaVersion": "1.4",
"runOnRequirements": [
{
"minServerVersion": "3.4",
"serverless": "forbid"
}
],
"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": "ping"
}
]
}
],
"tests": [
{
"description": "FindOneAndReplace when one document matches with collation returning the document after modification",
"operations": [
{
"object": "collection0",
"name": "findOneAndReplace",
"arguments": {
"filter": {
"x": "PING"
},
"replacement": {
"x": "pong"
},
"projection": {
"x": 1,
"_id": 0
},
"returnDocument": "After",
"sort": {
"x": 1
},
"collation": {
"locale": "en_US",
"strength": 2
}
},
"expectResult": {
"x": "pong"
}
}
],
"outcome": [
{
"collectionName": "coll",
"databaseName": "crud-v1",
"documents": [
{
"_id": 1,
"x": 11
},
{
"_id": 2,
"x": "pong"
}
]
}
]
}
]
}

View File

@ -0,0 +1,254 @@
{
"description": "findOneAndReplace-upsert",
"schemaVersion": "1.0",
"runOnRequirements": [
{
"minServerVersion": "2.6"
}
],
"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": "FindOneAndReplace when no documents match without id specified with upsert returning the document before modification",
"operations": [
{
"object": "collection0",
"name": "findOneAndReplace",
"arguments": {
"filter": {
"_id": 4
},
"replacement": {
"x": 44
},
"projection": {
"x": 1,
"_id": 0
},
"upsert": true
},
"expectResult": null
}
],
"outcome": [
{
"collectionName": "coll",
"databaseName": "crud-v1",
"documents": [
{
"_id": 1,
"x": 11
},
{
"_id": 2,
"x": 22
},
{
"_id": 3,
"x": 33
},
{
"_id": 4,
"x": 44
}
]
}
]
},
{
"description": "FindOneAndReplace when no documents match without id specified with upsert returning the document after modification",
"operations": [
{
"object": "collection0",
"name": "findOneAndReplace",
"arguments": {
"filter": {
"_id": 4
},
"replacement": {
"x": 44
},
"projection": {
"x": 1,
"_id": 0
},
"returnDocument": "After",
"sort": {
"x": 1
},
"upsert": true
},
"expectResult": {
"x": 44
}
}
],
"outcome": [
{
"collectionName": "coll",
"databaseName": "crud-v1",
"documents": [
{
"_id": 1,
"x": 11
},
{
"_id": 2,
"x": 22
},
{
"_id": 3,
"x": 33
},
{
"_id": 4,
"x": 44
}
]
}
]
},
{
"description": "FindOneAndReplace when no documents match with id specified with upsert returning the document before modification",
"operations": [
{
"object": "collection0",
"name": "findOneAndReplace",
"arguments": {
"filter": {
"_id": 4
},
"replacement": {
"_id": 4,
"x": 44
},
"projection": {
"x": 1,
"_id": 0
},
"upsert": true
},
"expectResult": null
}
],
"outcome": [
{
"collectionName": "coll",
"databaseName": "crud-v1",
"documents": [
{
"_id": 1,
"x": 11
},
{
"_id": 2,
"x": 22
},
{
"_id": 3,
"x": 33
},
{
"_id": 4,
"x": 44
}
]
}
]
},
{
"description": "FindOneAndReplace when no documents match with id specified with upsert returning the document after modification",
"operations": [
{
"object": "collection0",
"name": "findOneAndReplace",
"arguments": {
"filter": {
"_id": 4
},
"replacement": {
"_id": 4,
"x": 44
},
"projection": {
"x": 1,
"_id": 0
},
"returnDocument": "After",
"sort": {
"x": 1
},
"upsert": true
},
"expectResult": {
"x": 44
}
}
],
"outcome": [
{
"collectionName": "coll",
"databaseName": "crud-v1",
"documents": [
{
"_id": 1,
"x": 11
},
{
"_id": 2,
"x": 22
},
{
"_id": 3,
"x": 33
},
{
"_id": 4,
"x": 44
}
]
}
]
}
]
}

View File

@ -0,0 +1,332 @@
{
"description": "findOneAndReplace",
"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": "FindOneAndReplace when many documents match returning the document before modification",
"operations": [
{
"object": "collection0",
"name": "findOneAndReplace",
"arguments": {
"filter": {
"_id": {
"$gt": 1
}
},
"replacement": {
"x": 32
},
"projection": {
"x": 1,
"_id": 0
},
"sort": {
"x": 1
}
},
"expectResult": {
"x": 22
}
}
],
"outcome": [
{
"collectionName": "coll",
"databaseName": "crud-v1",
"documents": [
{
"_id": 1,
"x": 11
},
{
"_id": 2,
"x": 32
},
{
"_id": 3,
"x": 33
}
]
}
]
},
{
"description": "FindOneAndReplace when many documents match returning the document after modification",
"operations": [
{
"object": "collection0",
"name": "findOneAndReplace",
"arguments": {
"filter": {
"_id": {
"$gt": 1
}
},
"replacement": {
"x": 32
},
"projection": {
"x": 1,
"_id": 0
},
"returnDocument": "After",
"sort": {
"x": 1
}
},
"expectResult": {
"x": 32
}
}
],
"outcome": [
{
"collectionName": "coll",
"databaseName": "crud-v1",
"documents": [
{
"_id": 1,
"x": 11
},
{
"_id": 2,
"x": 32
},
{
"_id": 3,
"x": 33
}
]
}
]
},
{
"description": "FindOneAndReplace when one document matches returning the document before modification",
"operations": [
{
"object": "collection0",
"name": "findOneAndReplace",
"arguments": {
"filter": {
"_id": 2
},
"replacement": {
"x": 32
},
"projection": {
"x": 1,
"_id": 0
},
"sort": {
"x": 1
}
},
"expectResult": {
"x": 22
}
}
],
"outcome": [
{
"collectionName": "coll",
"databaseName": "crud-v1",
"documents": [
{
"_id": 1,
"x": 11
},
{
"_id": 2,
"x": 32
},
{
"_id": 3,
"x": 33
}
]
}
]
},
{
"description": "FindOneAndReplace when one document matches returning the document after modification",
"operations": [
{
"object": "collection0",
"name": "findOneAndReplace",
"arguments": {
"filter": {
"_id": 2
},
"replacement": {
"x": 32
},
"projection": {
"x": 1,
"_id": 0
},
"returnDocument": "After",
"sort": {
"x": 1
}
},
"expectResult": {
"x": 32
}
}
],
"outcome": [
{
"collectionName": "coll",
"databaseName": "crud-v1",
"documents": [
{
"_id": 1,
"x": 11
},
{
"_id": 2,
"x": 32
},
{
"_id": 3,
"x": 33
}
]
}
]
},
{
"description": "FindOneAndReplace when no documents match returning the document before modification",
"operations": [
{
"object": "collection0",
"name": "findOneAndReplace",
"arguments": {
"filter": {
"_id": 4
},
"replacement": {
"x": 44
},
"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
}
]
}
]
},
{
"description": "FindOneAndReplace when no documents match returning the document after modification",
"operations": [
{
"object": "collection0",
"name": "findOneAndReplace",
"arguments": {
"filter": {
"_id": 4
},
"replacement": {
"x": 44
},
"projection": {
"x": 1,
"_id": 0
},
"returnDocument": "After",
"sort": {
"x": 1
}
},
"expectResult": null
}
],
"outcome": [
{
"collectionName": "coll",
"databaseName": "crud-v1",
"documents": [
{
"_id": 1,
"x": 11
},
{
"_id": 2,
"x": 22
},
{
"_id": 3,
"x": 33
}
]
}
]
}
]
}

View File

@ -0,0 +1,251 @@
{
"description": "findOneAndUpdate-arrayFilters",
"schemaVersion": "1.0",
"runOnRequirements": [
{
"minServerVersion": "3.5.6"
}
],
"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,
"y": [
{
"b": 3
},
{
"b": 1
}
]
},
{
"_id": 2,
"y": [
{
"b": 0
},
{
"b": 1
}
]
}
]
}
],
"tests": [
{
"description": "FindOneAndUpdate when no document matches arrayFilters",
"operations": [
{
"object": "collection0",
"name": "findOneAndUpdate",
"arguments": {
"filter": {},
"update": {
"$set": {
"y.$[i].b": 2
}
},
"arrayFilters": [
{
"i.b": 4
}
]
},
"expectResult": {
"_id": 1,
"y": [
{
"b": 3
},
{
"b": 1
}
]
}
}
],
"outcome": [
{
"collectionName": "coll",
"databaseName": "crud-v1",
"documents": [
{
"_id": 1,
"y": [
{
"b": 3
},
{
"b": 1
}
]
},
{
"_id": 2,
"y": [
{
"b": 0
},
{
"b": 1
}
]
}
]
}
]
},
{
"description": "FindOneAndUpdate when one document matches arrayFilters",
"operations": [
{
"object": "collection0",
"name": "findOneAndUpdate",
"arguments": {
"filter": {},
"update": {
"$set": {
"y.$[i].b": 2
}
},
"arrayFilters": [
{
"i.b": 3
}
]
},
"expectResult": {
"_id": 1,
"y": [
{
"b": 3
},
{
"b": 1
}
]
}
}
],
"outcome": [
{
"collectionName": "coll",
"databaseName": "crud-v1",
"documents": [
{
"_id": 1,
"y": [
{
"b": 2
},
{
"b": 1
}
]
},
{
"_id": 2,
"y": [
{
"b": 0
},
{
"b": 1
}
]
}
]
}
]
},
{
"description": "FindOneAndUpdate when multiple documents match arrayFilters",
"operations": [
{
"object": "collection0",
"name": "findOneAndUpdate",
"arguments": {
"filter": {},
"update": {
"$set": {
"y.$[i].b": 2
}
},
"arrayFilters": [
{
"i.b": 1
}
]
},
"expectResult": {
"_id": 1,
"y": [
{
"b": 3
},
{
"b": 1
}
]
}
}
],
"outcome": [
{
"collectionName": "coll",
"databaseName": "crud-v1",
"documents": [
{
"_id": 1,
"y": [
{
"b": 3
},
{
"b": 2
}
]
},
{
"_id": 2,
"y": [
{
"b": 0
},
{
"b": 1
}
]
}
]
}
]
}
]
}

View File

@ -0,0 +1,106 @@
{
"description": "findOneAndUpdate-collation",
"schemaVersion": "1.4",
"runOnRequirements": [
{
"minServerVersion": "3.4",
"serverless": "forbid"
}
],
"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": "ping"
},
{
"_id": 3,
"x": "pINg"
}
]
}
],
"tests": [
{
"description": "FindOneAndUpdate when many documents match with collation returning the document before modification",
"operations": [
{
"object": "collection0",
"name": "findOneAndUpdate",
"arguments": {
"filter": {
"x": "PING"
},
"update": {
"$set": {
"x": "pong"
}
},
"projection": {
"x": 1,
"_id": 0
},
"sort": {
"_id": 1
},
"collation": {
"locale": "en_US",
"strength": 2
}
},
"expectResult": {
"x": "ping"
}
}
],
"outcome": [
{
"collectionName": "coll",
"databaseName": "crud-v1",
"documents": [
{
"_id": 1,
"x": 11
},
{
"_id": 2,
"x": "pong"
},
{
"_id": 3,
"x": "pINg"
}
]
}
]
}
]
}

View File

@ -0,0 +1,448 @@
{
"description": "findOneAndUpdate",
"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": "FindOneAndUpdate when many documents match returning the document before modification",
"operations": [
{
"object": "collection0",
"name": "findOneAndUpdate",
"arguments": {
"filter": {
"_id": {
"$gt": 1
}
},
"update": {
"$inc": {
"x": 1
}
},
"projection": {
"x": 1,
"_id": 0
},
"sort": {
"x": 1
}
},
"expectResult": {
"x": 22
}
}
],
"outcome": [
{
"collectionName": "coll",
"databaseName": "crud-v1",
"documents": [
{
"_id": 1,
"x": 11
},
{
"_id": 2,
"x": 23
},
{
"_id": 3,
"x": 33
}
]
}
]
},
{
"description": "FindOneAndUpdate when many documents match returning the document after modification",
"operations": [
{
"object": "collection0",
"name": "findOneAndUpdate",
"arguments": {
"filter": {
"_id": {
"$gt": 1
}
},
"update": {
"$inc": {
"x": 1
}
},
"projection": {
"x": 1,
"_id": 0
},
"returnDocument": "After",
"sort": {
"x": 1
}
},
"expectResult": {
"x": 23
}
}
],
"outcome": [
{
"collectionName": "coll",
"databaseName": "crud-v1",
"documents": [
{
"_id": 1,
"x": 11
},
{
"_id": 2,
"x": 23
},
{
"_id": 3,
"x": 33
}
]
}
]
},
{
"description": "FindOneAndUpdate when one document matches returning the document before modification",
"operations": [
{
"object": "collection0",
"name": "findOneAndUpdate",
"arguments": {
"filter": {
"_id": 2
},
"update": {
"$inc": {
"x": 1
}
},
"projection": {
"x": 1,
"_id": 0
},
"sort": {
"x": 1
}
},
"expectResult": {
"x": 22
}
}
],
"outcome": [
{
"collectionName": "coll",
"databaseName": "crud-v1",
"documents": [
{
"_id": 1,
"x": 11
},
{
"_id": 2,
"x": 23
},
{
"_id": 3,
"x": 33
}
]
}
]
},
{
"description": "FindOneAndUpdate when one document matches returning the document after modification",
"operations": [
{
"object": "collection0",
"name": "findOneAndUpdate",
"arguments": {
"filter": {
"_id": 2
},
"update": {
"$inc": {
"x": 1
}
},
"projection": {
"x": 1,
"_id": 0
},
"returnDocument": "After",
"sort": {
"x": 1
}
},
"expectResult": {
"x": 23
}
}
],
"outcome": [
{
"collectionName": "coll",
"databaseName": "crud-v1",
"documents": [
{
"_id": 1,
"x": 11
},
{
"_id": 2,
"x": 23
},
{
"_id": 3,
"x": 33
}
]
}
]
},
{
"description": "FindOneAndUpdate when no documents match returning the document before modification",
"operations": [
{
"object": "collection0",
"name": "findOneAndUpdate",
"arguments": {
"filter": {
"_id": 4
},
"update": {
"$inc": {
"x": 1
}
},
"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
}
]
}
]
},
{
"description": "FindOneAndUpdate when no documents match with upsert returning the document before modification",
"operations": [
{
"object": "collection0",
"name": "findOneAndUpdate",
"arguments": {
"filter": {
"_id": 4
},
"update": {
"$inc": {
"x": 1
}
},
"projection": {
"x": 1,
"_id": 0
},
"upsert": true
},
"expectResult": null
}
],
"outcome": [
{
"collectionName": "coll",
"databaseName": "crud-v1",
"documents": [
{
"_id": 1,
"x": 11
},
{
"_id": 2,
"x": 22
},
{
"_id": 3,
"x": 33
},
{
"_id": 4,
"x": 1
}
]
}
]
},
{
"description": "FindOneAndUpdate when no documents match returning the document after modification",
"operations": [
{
"object": "collection0",
"name": "findOneAndUpdate",
"arguments": {
"filter": {
"_id": 4
},
"update": {
"$inc": {
"x": 1
}
},
"projection": {
"x": 1,
"_id": 0
},
"returnDocument": "After",
"sort": {
"x": 1
}
},
"expectResult": null
}
],
"outcome": [
{
"collectionName": "coll",
"databaseName": "crud-v1",
"documents": [
{
"_id": 1,
"x": 11
},
{
"_id": 2,
"x": 22
},
{
"_id": 3,
"x": 33
}
]
}
]
},
{
"description": "FindOneAndUpdate when no documents match with upsert returning the document after modification",
"operations": [
{
"object": "collection0",
"name": "findOneAndUpdate",
"arguments": {
"filter": {
"_id": 4
},
"update": {
"$inc": {
"x": 1
}
},
"projection": {
"x": 1,
"_id": 0
},
"returnDocument": "After",
"sort": {
"x": 1
},
"upsert": true
},
"expectResult": {
"x": 1
}
}
],
"outcome": [
{
"collectionName": "coll",
"databaseName": "crud-v1",
"documents": [
{
"_id": 1,
"x": 11
},
{
"_id": 2,
"x": 22
},
{
"_id": 3,
"x": 33
},
{
"_id": 4,
"x": 1
}
]
}
]
}
]
}

View File

@ -0,0 +1,205 @@
{
"description": "insertMany",
"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
}
]
}
],
"tests": [
{
"description": "InsertMany with non-existing documents",
"operations": [
{
"object": "collection0",
"name": "insertMany",
"arguments": {
"documents": [
{
"_id": 2,
"x": 22
},
{
"_id": 3,
"x": 33
}
],
"ordered": true
},
"expectResult": {
"$$unsetOrMatches": {
"insertedIds": {
"$$unsetOrMatches": {
"0": 2,
"1": 3
}
}
}
}
}
],
"outcome": [
{
"collectionName": "coll",
"databaseName": "crud-v1",
"documents": [
{
"_id": 1,
"x": 11
},
{
"_id": 2,
"x": 22
},
{
"_id": 3,
"x": 33
}
]
}
]
},
{
"description": "InsertMany continue-on-error behavior with unordered (preexisting duplicate key)",
"operations": [
{
"object": "collection0",
"name": "insertMany",
"arguments": {
"documents": [
{
"_id": 1,
"x": 11
},
{
"_id": 2,
"x": 22
},
{
"_id": 3,
"x": 33
}
],
"ordered": false
},
"expectError": {
"isError": true,
"expectResult": {
"deletedCount": 0,
"insertedCount": 2,
"matchedCount": 0,
"modifiedCount": 0,
"upsertedCount": 0,
"upsertedIds": {}
}
}
}
],
"outcome": [
{
"collectionName": "coll",
"databaseName": "crud-v1",
"documents": [
{
"_id": 1,
"x": 11
},
{
"_id": 2,
"x": 22
},
{
"_id": 3,
"x": 33
}
]
}
]
},
{
"description": "InsertMany continue-on-error behavior with unordered (duplicate key in requests)",
"operations": [
{
"object": "collection0",
"name": "insertMany",
"arguments": {
"documents": [
{
"_id": 2,
"x": 22
},
{
"_id": 2,
"x": 22
},
{
"_id": 3,
"x": 33
}
],
"ordered": false
},
"expectError": {
"isError": true,
"expectResult": {
"deletedCount": 0,
"insertedCount": 2,
"matchedCount": 0,
"modifiedCount": 0,
"upsertedCount": 0,
"upsertedIds": {}
}
}
}
],
"outcome": [
{
"collectionName": "coll",
"databaseName": "crud-v1",
"documents": [
{
"_id": 1,
"x": 11
},
{
"_id": 2,
"x": 22
},
{
"_id": 3,
"x": 33
}
]
}
]
}
]
}

View File

@ -0,0 +1,77 @@
{
"description": "insertOne",
"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
}
]
}
],
"tests": [
{
"description": "InsertOne with a non-existing document",
"operations": [
{
"object": "collection0",
"name": "insertOne",
"arguments": {
"document": {
"_id": 2,
"x": 22
}
},
"expectResult": {
"$$unsetOrMatches": {
"insertedId": {
"$$unsetOrMatches": 2
}
}
}
}
],
"outcome": [
{
"collectionName": "coll",
"databaseName": "crud-v1",
"documents": [
{
"_id": 1,
"x": 11
},
{
"_id": 2,
"x": 22
}
]
}
]
}
]
}

View File

@ -0,0 +1,92 @@
{
"description": "replaceOne-collation",
"schemaVersion": "1.4",
"runOnRequirements": [
{
"minServerVersion": "3.4",
"serverless": "forbid"
}
],
"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": "ping"
}
]
}
],
"tests": [
{
"description": "ReplaceOne when one document matches with collation",
"operations": [
{
"object": "collection0",
"name": "replaceOne",
"arguments": {
"filter": {
"x": "PING"
},
"replacement": {
"_id": 2,
"x": "pong"
},
"collation": {
"locale": "en_US",
"strength": 2
}
},
"expectResult": {
"matchedCount": 1,
"modifiedCount": 1,
"upsertedCount": 0
}
}
],
"outcome": [
{
"collectionName": "coll",
"databaseName": "crud-v1",
"documents": [
{
"_id": 1,
"x": 11
},
{
"_id": 2,
"x": "pong"
}
]
}
]
}
]
}

View File

@ -0,0 +1,259 @@
{
"description": "replaceOne",
"schemaVersion": "1.0",
"runOnRequirements": [
{
"minServerVersion": "2.6"
}
],
"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": "ReplaceOne when many documents match",
"operations": [
{
"object": "collection0",
"name": "replaceOne",
"arguments": {
"filter": {
"_id": {
"$gt": 1
}
},
"replacement": {
"x": 111
}
},
"expectResult": {
"matchedCount": 1,
"modifiedCount": 1,
"upsertedCount": 0
}
}
]
},
{
"description": "ReplaceOne when one document matches",
"operations": [
{
"object": "collection0",
"name": "replaceOne",
"arguments": {
"filter": {
"_id": 1
},
"replacement": {
"_id": 1,
"x": 111
}
},
"expectResult": {
"matchedCount": 1,
"modifiedCount": 1,
"upsertedCount": 0
}
}
],
"outcome": [
{
"collectionName": "coll",
"databaseName": "crud-v1",
"documents": [
{
"_id": 1,
"x": 111
},
{
"_id": 2,
"x": 22
},
{
"_id": 3,
"x": 33
}
]
}
]
},
{
"description": "ReplaceOne when no documents match",
"operations": [
{
"object": "collection0",
"name": "replaceOne",
"arguments": {
"filter": {
"_id": 4
},
"replacement": {
"_id": 4,
"x": 1
}
},
"expectResult": {
"matchedCount": 0,
"modifiedCount": 0,
"upsertedCount": 0
}
}
],
"outcome": [
{
"collectionName": "coll",
"databaseName": "crud-v1",
"documents": [
{
"_id": 1,
"x": 11
},
{
"_id": 2,
"x": 22
},
{
"_id": 3,
"x": 33
}
]
}
]
},
{
"description": "ReplaceOne with upsert when no documents match without an id specified",
"operations": [
{
"object": "collection0",
"name": "replaceOne",
"arguments": {
"filter": {
"_id": 4
},
"replacement": {
"x": 1
},
"upsert": true
},
"expectResult": {
"matchedCount": 0,
"modifiedCount": 0,
"upsertedCount": 1,
"upsertedId": 4
}
}
],
"outcome": [
{
"collectionName": "coll",
"databaseName": "crud-v1",
"documents": [
{
"_id": 1,
"x": 11
},
{
"_id": 2,
"x": 22
},
{
"_id": 3,
"x": 33
},
{
"_id": 4,
"x": 1
}
]
}
]
},
{
"description": "ReplaceOne with upsert when no documents match with an id specified",
"operations": [
{
"object": "collection0",
"name": "replaceOne",
"arguments": {
"filter": {
"_id": 4
},
"replacement": {
"_id": 4,
"x": 1
},
"upsert": true
},
"expectResult": {
"matchedCount": 0,
"modifiedCount": 0,
"upsertedCount": 1,
"upsertedId": 4
}
}
],
"outcome": [
{
"collectionName": "coll",
"databaseName": "crud-v1",
"documents": [
{
"_id": 1,
"x": 11
},
{
"_id": 2,
"x": 22
},
{
"_id": 3,
"x": 33
},
{
"_id": 4,
"x": 1
}
]
}
]
}
]
}

View File

@ -0,0 +1,233 @@
{
"description": "updateMany-arrayFilters",
"schemaVersion": "1.0",
"runOnRequirements": [
{
"minServerVersion": "3.5.6"
}
],
"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,
"y": [
{
"b": 3
},
{
"b": 1
}
]
},
{
"_id": 2,
"y": [
{
"b": 0
},
{
"b": 1
}
]
}
]
}
],
"tests": [
{
"description": "UpdateMany when no documents match arrayFilters",
"operations": [
{
"object": "collection0",
"name": "updateMany",
"arguments": {
"filter": {},
"update": {
"$set": {
"y.$[i].b": 2
}
},
"arrayFilters": [
{
"i.b": 4
}
]
},
"expectResult": {
"matchedCount": 2,
"modifiedCount": 0,
"upsertedCount": 0
}
}
],
"outcome": [
{
"collectionName": "coll",
"databaseName": "crud-v1",
"documents": [
{
"_id": 1,
"y": [
{
"b": 3
},
{
"b": 1
}
]
},
{
"_id": 2,
"y": [
{
"b": 0
},
{
"b": 1
}
]
}
]
}
]
},
{
"description": "UpdateMany when one document matches arrayFilters",
"operations": [
{
"object": "collection0",
"name": "updateMany",
"arguments": {
"filter": {},
"update": {
"$set": {
"y.$[i].b": 2
}
},
"arrayFilters": [
{
"i.b": 3
}
]
},
"expectResult": {
"matchedCount": 2,
"modifiedCount": 1,
"upsertedCount": 0
}
}
],
"outcome": [
{
"collectionName": "coll",
"databaseName": "crud-v1",
"documents": [
{
"_id": 1,
"y": [
{
"b": 2
},
{
"b": 1
}
]
},
{
"_id": 2,
"y": [
{
"b": 0
},
{
"b": 1
}
]
}
]
}
]
},
{
"description": "UpdateMany when multiple documents match arrayFilters",
"operations": [
{
"object": "collection0",
"name": "updateMany",
"arguments": {
"filter": {},
"update": {
"$set": {
"y.$[i].b": 2
}
},
"arrayFilters": [
{
"i.b": 1
}
]
},
"expectResult": {
"matchedCount": 2,
"modifiedCount": 2,
"upsertedCount": 0
}
}
],
"outcome": [
{
"collectionName": "coll",
"databaseName": "crud-v1",
"documents": [
{
"_id": 1,
"y": [
{
"b": 3
},
{
"b": 2
}
]
},
{
"_id": 2,
"y": [
{
"b": 0
},
{
"b": 2
}
]
}
]
}
]
}
]
}

View File

@ -0,0 +1,101 @@
{
"description": "updateMany-collation",
"schemaVersion": "1.4",
"runOnRequirements": [
{
"minServerVersion": "3.4",
"serverless": "forbid"
}
],
"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": "ping"
},
{
"_id": 3,
"x": "pINg"
}
]
}
],
"tests": [
{
"description": "UpdateMany when many documents match with collation",
"operations": [
{
"object": "collection0",
"name": "updateMany",
"arguments": {
"filter": {
"x": "ping"
},
"update": {
"$set": {
"x": "pong"
}
},
"collation": {
"locale": "en_US",
"strength": 2
}
},
"expectResult": {
"matchedCount": 2,
"modifiedCount": 2,
"upsertedCount": 0
}
}
],
"outcome": [
{
"collectionName": "coll",
"databaseName": "crud-v1",
"documents": [
{
"_id": 1,
"x": 11
},
{
"_id": 2,
"x": "pong"
},
{
"_id": 3,
"x": "pong"
}
]
}
]
}
]
}

View File

@ -0,0 +1,236 @@
{
"description": "updateMany",
"schemaVersion": "1.0",
"runOnRequirements": [
{
"minServerVersion": "2.6"
}
],
"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": "UpdateMany when many documents match",
"operations": [
{
"object": "collection0",
"name": "updateMany",
"arguments": {
"filter": {
"_id": {
"$gt": 1
}
},
"update": {
"$inc": {
"x": 1
}
}
},
"expectResult": {
"matchedCount": 2,
"modifiedCount": 2,
"upsertedCount": 0
}
}
],
"outcome": [
{
"collectionName": "coll",
"databaseName": "crud-v1",
"documents": [
{
"_id": 1,
"x": 11
},
{
"_id": 2,
"x": 23
},
{
"_id": 3,
"x": 34
}
]
}
]
},
{
"description": "UpdateMany when one document matches",
"operations": [
{
"object": "collection0",
"name": "updateMany",
"arguments": {
"filter": {
"_id": 1
},
"update": {
"$inc": {
"x": 1
}
}
},
"expectResult": {
"matchedCount": 1,
"modifiedCount": 1,
"upsertedCount": 0
}
}
],
"outcome": [
{
"collectionName": "coll",
"databaseName": "crud-v1",
"documents": [
{
"_id": 1,
"x": 12
},
{
"_id": 2,
"x": 22
},
{
"_id": 3,
"x": 33
}
]
}
]
},
{
"description": "UpdateMany when no documents match",
"operations": [
{
"object": "collection0",
"name": "updateMany",
"arguments": {
"filter": {
"_id": 4
},
"update": {
"$inc": {
"x": 1
}
}
},
"expectResult": {
"matchedCount": 0,
"modifiedCount": 0,
"upsertedCount": 0
}
}
],
"outcome": [
{
"collectionName": "coll",
"databaseName": "crud-v1",
"documents": [
{
"_id": 1,
"x": 11
},
{
"_id": 2,
"x": 22
},
{
"_id": 3,
"x": 33
}
]
}
]
},
{
"description": "UpdateMany with upsert when no documents match",
"operations": [
{
"object": "collection0",
"name": "updateMany",
"arguments": {
"filter": {
"_id": 4
},
"update": {
"$inc": {
"x": 1
}
},
"upsert": true
},
"expectResult": {
"matchedCount": 0,
"modifiedCount": 0,
"upsertedCount": 1,
"upsertedId": 4
}
}
],
"outcome": [
{
"collectionName": "coll",
"databaseName": "crud-v1",
"documents": [
{
"_id": 1,
"x": 11
},
{
"_id": 2,
"x": 22
},
{
"_id": 3,
"x": 33
},
{
"_id": 4,
"x": 1
}
]
}
]
}
]
}

View File

@ -1,72 +1,110 @@
{
"data": [
"description": "updateOne-arrayFilters",
"schemaVersion": "1.0",
"runOnRequirements": [
{
"_id": 1,
"y": [
{
"b": 3
},
{
"b": 1
}
]
"minServerVersion": "3.5.6"
}
],
"createEntities": [
{
"client": {
"id": "client0"
}
},
{
"_id": 2,
"y": [
{
"b": 0
},
{
"b": 1
}
]
"database": {
"id": "database0",
"client": "client0",
"databaseName": "crud-v1"
}
},
{
"_id": 3,
"y": [
"collection": {
"id": "collection0",
"database": "database0",
"collectionName": "coll"
}
}
],
"initialData": [
{
"collectionName": "coll",
"databaseName": "crud-v1",
"documents": [
{
"b": 5,
"c": [
"_id": 1,
"y": [
{
"d": 2
"b": 3
},
{
"d": 1
"b": 1
}
]
},
{
"_id": 2,
"y": [
{
"b": 0
},
{
"b": 1
}
]
},
{
"_id": 3,
"y": [
{
"b": 5,
"c": [
{
"d": 2
},
{
"d": 1
}
]
}
]
}
]
}
],
"minServerVersion": "3.5.6",
"tests": [
{
"description": "UpdateOne when no document matches arrayFilters",
"operation": {
"name": "updateOne",
"arguments": {
"filter": {},
"update": {
"$set": {
"y.$[i].b": 2
}
"operations": [
{
"object": "collection0",
"name": "updateOne",
"arguments": {
"filter": {},
"update": {
"$set": {
"y.$[i].b": 2
}
},
"arrayFilters": [
{
"i.b": 4
}
]
},
"arrayFilters": [
{
"i.b": 4
}
]
"expectResult": {
"matchedCount": 1,
"modifiedCount": 0,
"upsertedCount": 0
}
}
},
"outcome": {
"result": {
"matchedCount": 1,
"modifiedCount": 0,
"upsertedCount": 0
},
"collection": {
"data": [
],
"outcome": [
{
"collectionName": "coll",
"databaseName": "crud-v1",
"documents": [
{
"_id": 1,
"y": [
@ -107,34 +145,39 @@
}
]
}
}
]
},
{
"description": "UpdateOne when one document matches arrayFilters",
"operation": {
"name": "updateOne",
"arguments": {
"filter": {},
"update": {
"$set": {
"y.$[i].b": 2
}
"operations": [
{
"object": "collection0",
"name": "updateOne",
"arguments": {
"filter": {},
"update": {
"$set": {
"y.$[i].b": 2
}
},
"arrayFilters": [
{
"i.b": 3
}
]
},
"arrayFilters": [
{
"i.b": 3
}
]
"expectResult": {
"matchedCount": 1,
"modifiedCount": 1,
"upsertedCount": 0
}
}
},
"outcome": {
"result": {
"matchedCount": 1,
"modifiedCount": 1,
"upsertedCount": 0
},
"collection": {
"data": [
],
"outcome": [
{
"collectionName": "coll",
"databaseName": "crud-v1",
"documents": [
{
"_id": 1,
"y": [
@ -175,34 +218,39 @@
}
]
}
}
]
},
{
"description": "UpdateOne when multiple documents match arrayFilters",
"operation": {
"name": "updateOne",
"arguments": {
"filter": {},
"update": {
"$set": {
"y.$[i].b": 2
}
"operations": [
{
"object": "collection0",
"name": "updateOne",
"arguments": {
"filter": {},
"update": {
"$set": {
"y.$[i].b": 2
}
},
"arrayFilters": [
{
"i.b": 1
}
]
},
"arrayFilters": [
{
"i.b": 1
}
]
"expectResult": {
"matchedCount": 1,
"modifiedCount": 1,
"upsertedCount": 0
}
}
},
"outcome": {
"result": {
"matchedCount": 1,
"modifiedCount": 1,
"upsertedCount": 0
},
"collection": {
"data": [
],
"outcome": [
{
"collectionName": "coll",
"databaseName": "crud-v1",
"documents": [
{
"_id": 1,
"y": [
@ -243,39 +291,44 @@
}
]
}
}
]
},
{
"description": "UpdateOne when no documents match multiple arrayFilters",
"operation": {
"name": "updateOne",
"arguments": {
"filter": {
"_id": 3
},
"update": {
"$set": {
"y.$[i].c.$[j].d": 0
}
},
"arrayFilters": [
{
"i.b": 5
"operations": [
{
"object": "collection0",
"name": "updateOne",
"arguments": {
"filter": {
"_id": 3
},
{
"j.d": 3
}
]
"update": {
"$set": {
"y.$[i].c.$[j].d": 0
}
},
"arrayFilters": [
{
"i.b": 5
},
{
"j.d": 3
}
]
},
"expectResult": {
"matchedCount": 1,
"modifiedCount": 0,
"upsertedCount": 0
}
}
},
"outcome": {
"result": {
"matchedCount": 1,
"modifiedCount": 0,
"upsertedCount": 0
},
"collection": {
"data": [
],
"outcome": [
{
"collectionName": "coll",
"databaseName": "crud-v1",
"documents": [
{
"_id": 1,
"y": [
@ -316,39 +369,44 @@
}
]
}
}
]
},
{
"description": "UpdateOne when one document matches multiple arrayFilters",
"operation": {
"name": "updateOne",
"arguments": {
"filter": {
"_id": 3
},
"update": {
"$set": {
"y.$[i].c.$[j].d": 0
}
},
"arrayFilters": [
{
"i.b": 5
"operations": [
{
"object": "collection0",
"name": "updateOne",
"arguments": {
"filter": {
"_id": 3
},
{
"j.d": 1
}
]
"update": {
"$set": {
"y.$[i].c.$[j].d": 0
}
},
"arrayFilters": [
{
"i.b": 5
},
{
"j.d": 1
}
]
},
"expectResult": {
"matchedCount": 1,
"modifiedCount": 1,
"upsertedCount": 0
}
}
},
"outcome": {
"result": {
"matchedCount": 1,
"modifiedCount": 1,
"upsertedCount": 0
},
"collection": {
"data": [
],
"outcome": [
{
"collectionName": "coll",
"databaseName": "crud-v1",
"documents": [
{
"_id": 1,
"y": [
@ -389,7 +447,7 @@
}
]
}
}
]
}
]
}

View File

@ -0,0 +1,93 @@
{
"description": "updateOne-collation",
"schemaVersion": "1.4",
"runOnRequirements": [
{
"minServerVersion": "3.4",
"serverless": "forbid"
}
],
"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": "ping"
}
]
}
],
"tests": [
{
"description": "UpdateOne when one document matches with collation",
"operations": [
{
"object": "collection0",
"name": "updateOne",
"arguments": {
"filter": {
"x": "PING"
},
"update": {
"$set": {
"x": "pong"
}
},
"collation": {
"locale": "en_US",
"strength": 2
}
},
"expectResult": {
"matchedCount": 1,
"modifiedCount": 1,
"upsertedCount": 0
}
}
],
"outcome": [
{
"collectionName": "coll",
"databaseName": "crud-v1",
"documents": [
{
"_id": 1,
"x": 11
},
{
"_id": 2,
"x": "pong"
}
]
}
]
}
]
}

View File

@ -0,0 +1,216 @@
{
"description": "updateOne",
"schemaVersion": "1.0",
"runOnRequirements": [
{
"minServerVersion": "2.6"
}
],
"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": "UpdateOne when many documents match",
"operations": [
{
"object": "collection0",
"name": "updateOne",
"arguments": {
"filter": {
"_id": {
"$gt": 1
}
},
"update": {
"$inc": {
"x": 1
}
}
},
"expectResult": {
"matchedCount": 1,
"modifiedCount": 1,
"upsertedCount": 0
}
}
]
},
{
"description": "UpdateOne when one document matches",
"operations": [
{
"object": "collection0",
"name": "updateOne",
"arguments": {
"filter": {
"_id": 1
},
"update": {
"$inc": {
"x": 1
}
}
},
"expectResult": {
"matchedCount": 1,
"modifiedCount": 1,
"upsertedCount": 0
}
}
],
"outcome": [
{
"collectionName": "coll",
"databaseName": "crud-v1",
"documents": [
{
"_id": 1,
"x": 12
},
{
"_id": 2,
"x": 22
},
{
"_id": 3,
"x": 33
}
]
}
]
},
{
"description": "UpdateOne when no documents match",
"operations": [
{
"object": "collection0",
"name": "updateOne",
"arguments": {
"filter": {
"_id": 4
},
"update": {
"$inc": {
"x": 1
}
}
},
"expectResult": {
"matchedCount": 0,
"modifiedCount": 0,
"upsertedCount": 0
}
}
],
"outcome": [
{
"collectionName": "coll",
"databaseName": "crud-v1",
"documents": [
{
"_id": 1,
"x": 11
},
{
"_id": 2,
"x": 22
},
{
"_id": 3,
"x": 33
}
]
}
]
},
{
"description": "UpdateOne with upsert when no documents match",
"operations": [
{
"object": "collection0",
"name": "updateOne",
"arguments": {
"filter": {
"_id": 4
},
"update": {
"$inc": {
"x": 1
}
},
"upsert": true
},
"expectResult": {
"matchedCount": 0,
"modifiedCount": 0,
"upsertedCount": 1,
"upsertedId": 4
}
}
],
"outcome": [
{
"collectionName": "coll",
"databaseName": "crud-v1",
"documents": [
{
"_id": 1,
"x": 11
},
{
"_id": 2,
"x": 22
},
{
"_id": 3,
"x": 33
},
{
"_id": 4,
"x": 1
}
]
}
]
}
]
}

View File

@ -1,39 +0,0 @@
{
"data": [
{
"_id": 1,
"x": "ping"
}
],
"minServerVersion": "3.4",
"serverless": "forbid",
"tests": [
{
"description": "Aggregate with collation",
"operation": {
"name": "aggregate",
"arguments": {
"pipeline": [
{
"$match": {
"x": "PING"
}
}
],
"collation": {
"locale": "en_US",
"strength": 2
}
}
},
"outcome": {
"result": [
{
"_id": 1,
"x": "ping"
}
]
}
}
]
}

View File

@ -1,102 +0,0 @@
{
"data": [
{
"_id": 1,
"x": 11
},
{
"_id": 2,
"x": 22
},
{
"_id": 3,
"x": 33
}
],
"minServerVersion": "2.6",
"serverless": "forbid",
"tests": [
{
"description": "Aggregate with $out",
"operation": {
"name": "aggregate",
"arguments": {
"pipeline": [
{
"$sort": {
"x": 1
}
},
{
"$match": {
"_id": {
"$gt": 1
}
}
},
{
"$out": "other_test_collection"
}
],
"batchSize": 2
}
},
"outcome": {
"collection": {
"name": "other_test_collection",
"data": [
{
"_id": 2,
"x": 22
},
{
"_id": 3,
"x": 33
}
]
}
}
},
{
"description": "Aggregate with $out and batch size of 0",
"operation": {
"name": "aggregate",
"arguments": {
"pipeline": [
{
"$sort": {
"x": 1
}
},
{
"$match": {
"_id": {
"$gt": 1
}
}
},
{
"$out": "other_test_collection"
}
],
"batchSize": 0
}
},
"outcome": {
"collection": {
"name": "other_test_collection",
"data": [
{
"_id": 2,
"x": 22
},
{
"_id": 3,
"x": 33
}
]
}
}
}
]
}

View File

@ -1,53 +0,0 @@
{
"data": [
{
"_id": 1,
"x": 11
},
{
"_id": 2,
"x": 22
},
{
"_id": 3,
"x": 33
}
],
"tests": [
{
"description": "Aggregate with multiple stages",
"operation": {
"name": "aggregate",
"arguments": {
"pipeline": [
{
"$sort": {
"x": 1
}
},
{
"$match": {
"_id": {
"$gt": 1
}
}
}
],
"batchSize": 2
}
},
"outcome": {
"result": [
{
"_id": 2,
"x": 22
},
{
"_id": 3,
"x": 33
}
]
}
}
]
}

View File

@ -1,48 +0,0 @@
{
"data": [
{
"_id": 1,
"x": "PING"
}
],
"minServerVersion": "3.4",
"serverless": "forbid",
"tests": [
{
"description": "Count documents with collation",
"operation": {
"name": "countDocuments",
"arguments": {
"filter": {
"x": "ping"
},
"collation": {
"locale": "en_US",
"strength": 2
}
}
},
"outcome": {
"result": 1
}
},
{
"description": "Deprecated count with collation",
"operation": {
"name": "count",
"arguments": {
"filter": {
"x": "ping"
},
"collation": {
"locale": "en_US",
"strength": 2
}
}
},
"outcome": {
"result": 1
}
}
]
}

View File

@ -1,39 +0,0 @@
{
"data": [],
"tests": [
{
"description": "Estimated document count with empty collection",
"operation": {
"name": "estimatedDocumentCount",
"arguments": {}
},
"outcome": {
"result": 0
}
},
{
"description": "Count documents with empty collection",
"operation": {
"name": "countDocuments",
"arguments": {
"filter": {}
}
},
"outcome": {
"result": 0
}
},
{
"description": "Deprecated count with empty collection",
"operation": {
"name": "count",
"arguments": {
"filter": {}
}
},
"outcome": {
"result": 0
}
}
]
}

View File

@ -1,112 +0,0 @@
{
"data": [
{
"_id": 1,
"x": 11
},
{
"_id": 2,
"x": 22
},
{
"_id": 3,
"x": 33
}
],
"tests": [
{
"description": "Estimated document count",
"operation": {
"name": "estimatedDocumentCount",
"arguments": {}
},
"outcome": {
"result": 3
}
},
{
"description": "Count documents without a filter",
"operation": {
"name": "countDocuments",
"arguments": {
"filter": {}
}
},
"outcome": {
"result": 3
}
},
{
"description": "Count documents with a filter",
"operation": {
"name": "countDocuments",
"arguments": {
"filter": {
"_id": {
"$gt": 1
}
}
}
},
"outcome": {
"result": 2
}
},
{
"description": "Count documents with skip and limit",
"operation": {
"name": "countDocuments",
"arguments": {
"filter": {},
"skip": 1,
"limit": 3
}
},
"outcome": {
"result": 2
}
},
{
"description": "Deprecated count without a filter",
"operation": {
"name": "count",
"arguments": {
"filter": {}
}
},
"outcome": {
"result": 3
}
},
{
"description": "Deprecated count with a filter",
"operation": {
"name": "count",
"arguments": {
"filter": {
"_id": {
"$gt": 1
}
}
}
},
"outcome": {
"result": 2
}
},
{
"description": "Deprecated count with skip and limit",
"operation": {
"name": "count",
"arguments": {
"filter": {},
"skip": 1,
"limit": 3
}
},
"outcome": {
"result": 2
}
}
]
}

View File

@ -1,34 +0,0 @@
{
"data": [
{
"_id": 1,
"string": "PING"
},
{
"_id": 2,
"string": "ping"
}
],
"minServerVersion": "3.4",
"serverless": "forbid",
"tests": [
{
"description": "Distinct with a collation",
"operation": {
"name": "distinct",
"arguments": {
"fieldName": "string",
"collation": {
"locale": "en_US",
"strength": 2
}
}
},
"outcome": {
"result": [
"PING"
]
}
}
]
}

View File

@ -1,55 +0,0 @@
{
"data": [
{
"_id": 1,
"x": 11
},
{
"_id": 2,
"x": 22
},
{
"_id": 3,
"x": 33
}
],
"tests": [
{
"description": "Distinct without a filter",
"operation": {
"name": "distinct",
"arguments": {
"fieldName": "x",
"filter": {}
}
},
"outcome": {
"result": [
11,
22,
33
]
}
},
{
"description": "Distinct with a filter",
"operation": {
"name": "distinct",
"arguments": {
"fieldName": "x",
"filter": {
"_id": {
"$gt": 1
}
}
}
},
"outcome": {
"result": [
22,
33
]
}
}
]
}

View File

@ -1,35 +0,0 @@
{
"data": [
{
"_id": 1,
"x": "ping"
}
],
"minServerVersion": "3.4",
"serverless": "forbid",
"tests": [
{
"description": "Find with a collation",
"operation": {
"name": "find",
"arguments": {
"filter": {
"x": "PING"
},
"collation": {
"locale": "en_US",
"strength": 2
}
}
},
"outcome": {
"result": [
{
"_id": 1,
"x": "ping"
}
]
}
}
]
}

View File

@ -1,105 +0,0 @@
{
"data": [
{
"_id": 1,
"x": 11
},
{
"_id": 2,
"x": 22
},
{
"_id": 3,
"x": 33
},
{
"_id": 4,
"x": 44
},
{
"_id": 5,
"x": 55
}
],
"tests": [
{
"description": "Find with filter",
"operation": {
"name": "find",
"arguments": {
"filter": {
"_id": 1
}
}
},
"outcome": {
"result": [
{
"_id": 1,
"x": 11
}
]
}
},
{
"description": "Find with filter, sort, skip, and limit",
"operation": {
"name": "find",
"arguments": {
"filter": {
"_id": {
"$gt": 2
}
},
"sort": {
"_id": 1
},
"skip": 2,
"limit": 2
}
},
"outcome": {
"result": [
{
"_id": 5,
"x": 55
}
]
}
},
{
"description": "Find with limit, sort, and batchsize",
"operation": {
"name": "find",
"arguments": {
"filter": {},
"sort": {
"_id": 1
},
"limit": 4,
"batchSize": 2
}
},
"outcome": {
"result": [
{
"_id": 1,
"x": 11
},
{
"_id": 2,
"x": 22
},
{
"_id": 3,
"x": 33
},
{
"_id": 4,
"x": 44
}
]
}
}
]
}

View File

@ -1,111 +0,0 @@
{
"data": [
{
"_id": 1,
"y": [
{
"b": 3
},
{
"b": 1
}
]
},
{
"_id": 2,
"y": [
{
"b": 0
},
{
"b": 1
}
]
}
],
"minServerVersion": "3.5.6",
"tests": [
{
"description": "BulkWrite with arrayFilters",
"operation": {
"name": "bulkWrite",
"arguments": {
"requests": [
{
"name": "updateOne",
"arguments": {
"filter": {},
"update": {
"$set": {
"y.$[i].b": 2
}
},
"arrayFilters": [
{
"i.b": 3
}
]
}
},
{
"name": "updateMany",
"arguments": {
"filter": {},
"update": {
"$set": {
"y.$[i].b": 2
}
},
"arrayFilters": [
{
"i.b": 1
}
]
}
}
],
"options": {
"ordered": true
}
}
},
"outcome": {
"result": {
"deletedCount": 0,
"insertedCount": 0,
"insertedIds": {},
"matchedCount": 3,
"modifiedCount": 3,
"upsertedCount": 0,
"upsertedIds": {}
},
"collection": {
"data": [
{
"_id": 1,
"y": [
{
"b": 2
},
{
"b": 2
}
]
},
{
"_id": 2,
"y": [
{
"b": 0
},
{
"b": 2
}
]
}
]
}
}
}
]
}

View File

@ -1,218 +0,0 @@
{
"data": [
{
"_id": 1,
"x": 11
},
{
"_id": 2,
"x": "ping"
},
{
"_id": 3,
"x": "pINg"
},
{
"_id": 4,
"x": "pong"
},
{
"_id": 5,
"x": "pONg"
}
],
"minServerVersion": "3.4",
"serverless": "forbid",
"tests": [
{
"description": "BulkWrite with delete operations and collation",
"operation": {
"name": "bulkWrite",
"arguments": {
"requests": [
{
"name": "deleteOne",
"arguments": {
"filter": {
"x": "PING"
},
"collation": {
"locale": "en_US",
"strength": 2
}
}
},
{
"name": "deleteOne",
"arguments": {
"filter": {
"x": "PING"
},
"collation": {
"locale": "en_US",
"strength": 2
}
}
},
{
"name": "deleteMany",
"arguments": {
"filter": {
"x": "PONG"
},
"collation": {
"locale": "en_US",
"strength": 2
}
}
}
],
"options": {
"ordered": true
}
}
},
"outcome": {
"result": {
"deletedCount": 4,
"insertedCount": 0,
"insertedIds": {},
"matchedCount": 0,
"modifiedCount": 0,
"upsertedCount": 0,
"upsertedIds": {}
},
"collection": {
"data": [
{
"_id": 1,
"x": 11
}
]
}
}
},
{
"description": "BulkWrite with update operations and collation",
"operation": {
"name": "bulkWrite",
"arguments": {
"requests": [
{
"name": "updateMany",
"arguments": {
"filter": {
"x": "ping"
},
"update": {
"$set": {
"x": "PONG"
}
},
"collation": {
"locale": "en_US",
"strength": 3
}
}
},
{
"name": "updateOne",
"arguments": {
"filter": {
"x": "ping"
},
"update": {
"$set": {
"x": "PONG"
}
},
"collation": {
"locale": "en_US",
"strength": 2
}
}
},
{
"name": "replaceOne",
"arguments": {
"filter": {
"x": "ping"
},
"replacement": {
"_id": 6,
"x": "ping"
},
"upsert": true,
"collation": {
"locale": "en_US",
"strength": 3
}
}
},
{
"name": "updateMany",
"arguments": {
"filter": {
"x": "pong"
},
"update": {
"$set": {
"x": "PONG"
}
},
"collation": {
"locale": "en_US",
"strength": 2
}
}
}
],
"options": {
"ordered": true
}
}
},
"outcome": {
"result": {
"deletedCount": 0,
"insertedCount": 0,
"insertedIds": {},
"matchedCount": 6,
"modifiedCount": 4,
"upsertedCount": 1,
"upsertedIds": {
"2": 6
}
},
"collection": {
"data": [
{
"_id": 1,
"x": 11
},
{
"_id": 2,
"x": "PONG"
},
{
"_id": 3,
"x": "PONG"
},
{
"_id": 4,
"x": "PONG"
},
{
"_id": 5,
"x": "PONG"
},
{
"_id": 6,
"x": "ping"
}
]
}
}
}
]
}

View File

@ -1,778 +0,0 @@
{
"data": [
{
"_id": 1,
"x": 11
},
{
"_id": 2,
"x": 22
}
],
"minServerVersion": "2.6",
"tests": [
{
"description": "BulkWrite with deleteOne operations",
"operation": {
"name": "bulkWrite",
"arguments": {
"requests": [
{
"name": "deleteOne",
"arguments": {
"filter": {
"_id": 3
}
}
},
{
"name": "deleteOne",
"arguments": {
"filter": {
"_id": 2
}
}
}
],
"options": {
"ordered": true
}
}
},
"outcome": {
"result": {
"deletedCount": 1,
"insertedCount": 0,
"insertedIds": {},
"matchedCount": 0,
"modifiedCount": 0,
"upsertedCount": 0,
"upsertedIds": {}
},
"collection": {
"data": [
{
"_id": 1,
"x": 11
}
]
}
}
},
{
"description": "BulkWrite with deleteMany operations",
"operation": {
"name": "bulkWrite",
"arguments": {
"requests": [
{
"name": "deleteMany",
"arguments": {
"filter": {
"x": {
"$lt": 11
}
}
}
},
{
"name": "deleteMany",
"arguments": {
"filter": {
"x": {
"$lte": 22
}
}
}
}
],
"options": {
"ordered": true
}
}
},
"outcome": {
"result": {
"deletedCount": 2,
"insertedCount": 0,
"insertedIds": {},
"matchedCount": 0,
"modifiedCount": 0,
"upsertedCount": 0,
"upsertedIds": {}
},
"collection": {
"data": []
}
}
},
{
"description": "BulkWrite with insertOne operations",
"operation": {
"name": "bulkWrite",
"arguments": {
"requests": [
{
"name": "insertOne",
"arguments": {
"document": {
"_id": 3,
"x": 33
}
}
},
{
"name": "insertOne",
"arguments": {
"document": {
"_id": 4,
"x": 44
}
}
}
],
"options": {
"ordered": true
}
}
},
"outcome": {
"result": {
"deletedCount": 0,
"insertedCount": 2,
"insertedIds": {
"0": 3,
"1": 4
},
"matchedCount": 0,
"modifiedCount": 0,
"upsertedCount": 0,
"upsertedIds": {}
},
"collection": {
"data": [
{
"_id": 1,
"x": 11
},
{
"_id": 2,
"x": 22
},
{
"_id": 3,
"x": 33
},
{
"_id": 4,
"x": 44
}
]
}
}
},
{
"description": "BulkWrite with replaceOne operations",
"operation": {
"name": "bulkWrite",
"arguments": {
"requests": [
{
"name": "replaceOne",
"arguments": {
"filter": {
"_id": 3
},
"replacement": {
"x": 33
}
}
},
{
"name": "replaceOne",
"arguments": {
"filter": {
"_id": 1
},
"replacement": {
"x": 12
}
}
},
{
"name": "replaceOne",
"arguments": {
"filter": {
"_id": 3
},
"replacement": {
"x": 33
},
"upsert": true
}
}
],
"options": {
"ordered": true
}
}
},
"outcome": {
"result": {
"deletedCount": 0,
"insertedCount": 0,
"insertedIds": {},
"matchedCount": 1,
"modifiedCount": 1,
"upsertedCount": 1,
"upsertedIds": {
"2": 3
}
},
"collection": {
"data": [
{
"_id": 1,
"x": 12
},
{
"_id": 2,
"x": 22
},
{
"_id": 3,
"x": 33
}
]
}
}
},
{
"description": "BulkWrite with updateOne operations",
"operation": {
"name": "bulkWrite",
"arguments": {
"requests": [
{
"name": "updateOne",
"arguments": {
"filter": {
"_id": 0
},
"update": {
"$set": {
"x": 0
}
}
}
},
{
"name": "updateOne",
"arguments": {
"filter": {
"_id": 1
},
"update": {
"$set": {
"x": 11
}
}
}
},
{
"name": "updateOne",
"arguments": {
"filter": {
"_id": 2
},
"update": {
"$inc": {
"x": 1
}
}
}
},
{
"name": "updateOne",
"arguments": {
"filter": {
"_id": 3
},
"update": {
"$set": {
"x": 33
}
},
"upsert": true
}
}
],
"options": {
"ordered": true
}
}
},
"outcome": {
"result": {
"deletedCount": 0,
"insertedCount": 0,
"insertedIds": {},
"matchedCount": 2,
"modifiedCount": 1,
"upsertedCount": 1,
"upsertedIds": {
"3": 3
}
},
"collection": {
"data": [
{
"_id": 1,
"x": 11
},
{
"_id": 2,
"x": 23
},
{
"_id": 3,
"x": 33
}
]
}
}
},
{
"description": "BulkWrite with updateMany operations",
"operation": {
"name": "bulkWrite",
"arguments": {
"requests": [
{
"name": "updateMany",
"arguments": {
"filter": {
"x": {
"$lt": 11
}
},
"update": {
"$set": {
"x": 0
}
}
}
},
{
"name": "updateMany",
"arguments": {
"filter": {
"x": {
"$lte": 22
}
},
"update": {
"$unset": {
"y": 1
}
}
}
},
{
"name": "updateMany",
"arguments": {
"filter": {
"x": {
"$lte": 22
}
},
"update": {
"$inc": {
"x": 1
}
}
}
},
{
"name": "updateMany",
"arguments": {
"filter": {
"_id": 3
},
"update": {
"$set": {
"x": 33
}
},
"upsert": true
}
}
],
"options": {
"ordered": true
}
}
},
"outcome": {
"result": {
"deletedCount": 0,
"insertedCount": 0,
"insertedIds": {},
"matchedCount": 4,
"modifiedCount": 2,
"upsertedCount": 1,
"upsertedIds": {
"3": 3
}
},
"collection": {
"data": [
{
"_id": 1,
"x": 12
},
{
"_id": 2,
"x": 23
},
{
"_id": 3,
"x": 33
}
]
}
}
},
{
"description": "BulkWrite with mixed ordered operations",
"operation": {
"name": "bulkWrite",
"arguments": {
"requests": [
{
"name": "insertOne",
"arguments": {
"document": {
"_id": 3,
"x": 33
}
}
},
{
"name": "updateOne",
"arguments": {
"filter": {
"_id": 2
},
"update": {
"$inc": {
"x": 1
}
}
}
},
{
"name": "updateMany",
"arguments": {
"filter": {
"_id": {
"$gt": 1
}
},
"update": {
"$inc": {
"x": 1
}
}
}
},
{
"name": "insertOne",
"arguments": {
"document": {
"_id": 4,
"x": 44
}
}
},
{
"name": "deleteMany",
"arguments": {
"filter": {
"x": {
"$nin": [
24,
34
]
}
}
}
},
{
"name": "replaceOne",
"arguments": {
"filter": {
"_id": 4
},
"replacement": {
"_id": 4,
"x": 44
},
"upsert": true
}
}
],
"options": {
"ordered": true
}
}
},
"outcome": {
"result": {
"deletedCount": 2,
"insertedCount": 2,
"insertedIds": {
"0": 3,
"3": 4
},
"matchedCount": 3,
"modifiedCount": 3,
"upsertedCount": 1,
"upsertedIds": {
"5": 4
}
},
"collection": {
"data": [
{
"_id": 2,
"x": 24
},
{
"_id": 3,
"x": 34
},
{
"_id": 4,
"x": 44
}
]
}
}
},
{
"description": "BulkWrite with mixed unordered operations",
"operation": {
"name": "bulkWrite",
"arguments": {
"requests": [
{
"name": "replaceOne",
"arguments": {
"filter": {
"_id": 3
},
"replacement": {
"_id": 3,
"x": 33
},
"upsert": true
}
},
{
"name": "deleteOne",
"arguments": {
"filter": {
"_id": 1
}
}
},
{
"name": "updateOne",
"arguments": {
"filter": {
"_id": 2
},
"update": {
"$inc": {
"x": 1
}
}
}
}
],
"options": {
"ordered": false
}
}
},
"outcome": {
"result": {
"deletedCount": 1,
"insertedCount": 0,
"insertedIds": {},
"matchedCount": 1,
"modifiedCount": 1,
"upsertedCount": 1,
"upsertedIds": {
"0": 3
}
},
"collection": {
"data": [
{
"_id": 2,
"x": 23
},
{
"_id": 3,
"x": 33
}
]
}
}
},
{
"description": "BulkWrite continue-on-error behavior with unordered (preexisting duplicate key)",
"operation": {
"name": "bulkWrite",
"arguments": {
"requests": [
{
"name": "insertOne",
"arguments": {
"document": {
"_id": 2,
"x": 22
}
}
},
{
"name": "insertOne",
"arguments": {
"document": {
"_id": 3,
"x": 33
}
}
},
{
"name": "insertOne",
"arguments": {
"document": {
"_id": 4,
"x": 44
}
}
}
],
"options": {
"ordered": false
}
}
},
"outcome": {
"error": true,
"result": {
"deletedCount": 0,
"insertedCount": 2,
"matchedCount": 0,
"modifiedCount": 0,
"upsertedCount": 0,
"upsertedIds": {}
},
"collection": {
"data": [
{
"_id": 1,
"x": 11
},
{
"_id": 2,
"x": 22
},
{
"_id": 3,
"x": 33
},
{
"_id": 4,
"x": 44
}
]
}
}
},
{
"description": "BulkWrite continue-on-error behavior with unordered (duplicate key in requests)",
"operation": {
"name": "bulkWrite",
"arguments": {
"requests": [
{
"name": "insertOne",
"arguments": {
"document": {
"_id": 3,
"x": 33
}
}
},
{
"name": "insertOne",
"arguments": {
"document": {
"_id": 3,
"x": 33
}
}
},
{
"name": "insertOne",
"arguments": {
"document": {
"_id": 4,
"x": 44
}
}
}
],
"options": {
"ordered": false
}
}
},
"outcome": {
"error": true,
"result": {
"deletedCount": 0,
"insertedCount": 2,
"matchedCount": 0,
"modifiedCount": 0,
"upsertedCount": 0,
"upsertedIds": {}
},
"collection": {
"data": [
{
"_id": 1,
"x": 11
},
{
"_id": 2,
"x": 22
},
{
"_id": 3,
"x": 33
},
{
"_id": 4,
"x": 44
}
]
}
}
}
]
}

View File

@ -1,48 +0,0 @@
{
"data": [
{
"_id": 1,
"x": 11
},
{
"_id": 2,
"x": "ping"
},
{
"_id": 3,
"x": "pINg"
}
],
"minServerVersion": "3.4",
"serverless": "forbid",
"tests": [
{
"description": "DeleteMany when many documents match with collation",
"operation": {
"name": "deleteMany",
"arguments": {
"filter": {
"x": "PING"
},
"collation": {
"locale": "en_US",
"strength": 2
}
}
},
"outcome": {
"result": {
"deletedCount": 2
},
"collection": {
"data": [
{
"_id": 1,
"x": 11
}
]
}
}
}
]
}

View File

@ -1,76 +0,0 @@
{
"data": [
{
"_id": 1,
"x": 11
},
{
"_id": 2,
"x": 22
},
{
"_id": 3,
"x": 33
}
],
"tests": [
{
"description": "DeleteMany when many documents match",
"operation": {
"name": "deleteMany",
"arguments": {
"filter": {
"_id": {
"$gt": 1
}
}
}
},
"outcome": {
"result": {
"deletedCount": 2
},
"collection": {
"data": [
{
"_id": 1,
"x": 11
}
]
}
}
},
{
"description": "DeleteMany when no document matches",
"operation": {
"name": "deleteMany",
"arguments": {
"filter": {
"_id": 4
}
}
},
"outcome": {
"result": {
"deletedCount": 0
},
"collection": {
"data": [
{
"_id": 1,
"x": 11
},
{
"_id": 2,
"x": 22
},
{
"_id": 3,
"x": 33
}
]
}
}
}
]
}

View File

@ -1,52 +0,0 @@
{
"data": [
{
"_id": 1,
"x": 11
},
{
"_id": 2,
"x": "ping"
},
{
"_id": 3,
"x": "pINg"
}
],
"minServerVersion": "3.4",
"serverless": "forbid",
"tests": [
{
"description": "DeleteOne when many documents matches with collation",
"operation": {
"name": "deleteOne",
"arguments": {
"filter": {
"x": "PING"
},
"collation": {
"locale": "en_US",
"strength": 2
}
}
},
"outcome": {
"result": {
"deletedCount": 1
},
"collection": {
"data": [
{
"_id": 1,
"x": 11
},
{
"_id": 3,
"x": "pINg"
}
]
}
}
}
]
}

View File

@ -1,96 +0,0 @@
{
"data": [
{
"_id": 1,
"x": 11
},
{
"_id": 2,
"x": 22
},
{
"_id": 3,
"x": 33
}
],
"tests": [
{
"description": "DeleteOne when many documents match",
"operation": {
"name": "deleteOne",
"arguments": {
"filter": {
"_id": {
"$gt": 1
}
}
}
},
"outcome": {
"result": {
"deletedCount": 1
}
}
},
{
"description": "DeleteOne when one document matches",
"operation": {
"name": "deleteOne",
"arguments": {
"filter": {
"_id": 2
}
}
},
"outcome": {
"result": {
"deletedCount": 1
},
"collection": {
"data": [
{
"_id": 1,
"x": 11
},
{
"_id": 3,
"x": 33
}
]
}
}
},
{
"description": "DeleteOne when no documents match",
"operation": {
"name": "deleteOne",
"arguments": {
"filter": {
"_id": 4
}
}
},
"outcome": {
"result": {
"deletedCount": 0
},
"collection": {
"data": [
{
"_id": 1,
"x": 11
},
{
"_id": 2,
"x": 22
},
{
"_id": 3,
"x": 33
}
]
}
}
}
]
}

View File

@ -1,60 +0,0 @@
{
"data": [
{
"_id": 1,
"x": 11
},
{
"_id": 2,
"x": "ping"
},
{
"_id": 3,
"x": "pINg"
}
],
"minServerVersion": "3.4",
"serverless": "forbid",
"tests": [
{
"description": "FindOneAndDelete when one document matches with collation",
"operation": {
"name": "findOneAndDelete",
"arguments": {
"filter": {
"_id": 2,
"x": "PING"
},
"projection": {
"x": 1,
"_id": 0
},
"sort": {
"x": 1
},
"collation": {
"locale": "en_US",
"strength": 2
}
}
},
"outcome": {
"result": {
"x": "ping"
},
"collection": {
"data": [
{
"_id": 1,
"x": 11
},
{
"_id": 3,
"x": "pINg"
}
]
}
}
}
]
}

View File

@ -1,127 +0,0 @@
{
"data": [
{
"_id": 1,
"x": 11
},
{
"_id": 2,
"x": 22
},
{
"_id": 3,
"x": 33
}
],
"tests": [
{
"description": "FindOneAndDelete when many documents match",
"operation": {
"name": "findOneAndDelete",
"arguments": {
"filter": {
"_id": {
"$gt": 1
}
},
"projection": {
"x": 1,
"_id": 0
},
"sort": {
"x": 1
}
}
},
"outcome": {
"result": {
"x": 22
},
"collection": {
"data": [
{
"_id": 1,
"x": 11
},
{
"_id": 3,
"x": 33
}
]
}
}
},
{
"description": "FindOneAndDelete when one document matches",
"operation": {
"name": "findOneAndDelete",
"arguments": {
"filter": {
"_id": 2
},
"projection": {
"x": 1,
"_id": 0
},
"sort": {
"x": 1
}
}
},
"outcome": {
"result": {
"x": 22
},
"collection": {
"data": [
{
"_id": 1,
"x": 11
},
{
"_id": 3,
"x": 33
}
]
}
}
},
{
"description": "FindOneAndDelete when no documents match",
"operation": {
"name": "findOneAndDelete",
"arguments": {
"filter": {
"_id": 4
},
"projection": {
"x": 1,
"_id": 0
},
"sort": {
"x": 1
}
}
},
"outcome": {
"result": null,
"collection": {
"data": [
{
"_id": 1,
"x": 11
},
{
"_id": 2,
"x": 22
},
{
"_id": 3,
"x": 33
}
]
}
}
}
]
}

View File

@ -1,59 +0,0 @@
{
"data": [
{
"_id": 1,
"x": 11
},
{
"_id": 2,
"x": "ping"
}
],
"minServerVersion": "3.4",
"serverless": "forbid",
"tests": [
{
"description": "FindOneAndReplace when one document matches with collation returning the document after modification",
"operation": {
"name": "findOneAndReplace",
"arguments": {
"filter": {
"x": "PING"
},
"replacement": {
"x": "pong"
},
"projection": {
"x": 1,
"_id": 0
},
"returnDocument": "After",
"sort": {
"x": 1
},
"collation": {
"locale": "en_US",
"strength": 2
}
}
},
"outcome": {
"result": {
"x": "pong"
},
"collection": {
"data": [
{
"_id": 1,
"x": 11
},
{
"_id": 2,
"x": "pong"
}
]
}
}
}
]
}

View File

@ -1,201 +0,0 @@
{
"data": [
{
"_id": 1,
"x": 11
},
{
"_id": 2,
"x": 22
},
{
"_id": 3,
"x": 33
}
],
"minServerVersion": "2.6",
"tests": [
{
"description": "FindOneAndReplace when no documents match without id specified with upsert returning the document before modification",
"operation": {
"name": "findOneAndReplace",
"arguments": {
"filter": {
"_id": 4
},
"replacement": {
"x": 44
},
"projection": {
"x": 1,
"_id": 0
},
"upsert": true
}
},
"outcome": {
"result": null,
"collection": {
"data": [
{
"_id": 1,
"x": 11
},
{
"_id": 2,
"x": 22
},
{
"_id": 3,
"x": 33
},
{
"_id": 4,
"x": 44
}
]
}
}
},
{
"description": "FindOneAndReplace when no documents match without id specified with upsert returning the document after modification",
"operation": {
"name": "findOneAndReplace",
"arguments": {
"filter": {
"_id": 4
},
"replacement": {
"x": 44
},
"projection": {
"x": 1,
"_id": 0
},
"returnDocument": "After",
"sort": {
"x": 1
},
"upsert": true
}
},
"outcome": {
"result": {
"x": 44
},
"collection": {
"data": [
{
"_id": 1,
"x": 11
},
{
"_id": 2,
"x": 22
},
{
"_id": 3,
"x": 33
},
{
"_id": 4,
"x": 44
}
]
}
}
},
{
"description": "FindOneAndReplace when no documents match with id specified with upsert returning the document before modification",
"operation": {
"name": "findOneAndReplace",
"arguments": {
"filter": {
"_id": 4
},
"replacement": {
"_id": 4,
"x": 44
},
"projection": {
"x": 1,
"_id": 0
},
"upsert": true
}
},
"outcome": {
"result": null,
"collection": {
"data": [
{
"_id": 1,
"x": 11
},
{
"_id": 2,
"x": 22
},
{
"_id": 3,
"x": 33
},
{
"_id": 4,
"x": 44
}
]
}
}
},
{
"description": "FindOneAndReplace when no documents match with id specified with upsert returning the document after modification",
"operation": {
"name": "findOneAndReplace",
"arguments": {
"filter": {
"_id": 4
},
"replacement": {
"_id": 4,
"x": 44
},
"projection": {
"x": 1,
"_id": 0
},
"returnDocument": "After",
"sort": {
"x": 1
},
"upsert": true
}
},
"outcome": {
"result": {
"x": 44
},
"collection": {
"data": [
{
"_id": 1,
"x": 11
},
{
"_id": 2,
"x": 22
},
{
"_id": 3,
"x": 33
},
{
"_id": 4,
"x": 44
}
]
}
}
}
]
}

View File

@ -1,273 +0,0 @@
{
"data": [
{
"_id": 1,
"x": 11
},
{
"_id": 2,
"x": 22
},
{
"_id": 3,
"x": 33
}
],
"tests": [
{
"description": "FindOneAndReplace when many documents match returning the document before modification",
"operation": {
"name": "findOneAndReplace",
"arguments": {
"filter": {
"_id": {
"$gt": 1
}
},
"replacement": {
"x": 32
},
"projection": {
"x": 1,
"_id": 0
},
"sort": {
"x": 1
}
}
},
"outcome": {
"result": {
"x": 22
},
"collection": {
"data": [
{
"_id": 1,
"x": 11
},
{
"_id": 2,
"x": 32
},
{
"_id": 3,
"x": 33
}
]
}
}
},
{
"description": "FindOneAndReplace when many documents match returning the document after modification",
"operation": {
"name": "findOneAndReplace",
"arguments": {
"filter": {
"_id": {
"$gt": 1
}
},
"replacement": {
"x": 32
},
"projection": {
"x": 1,
"_id": 0
},
"returnDocument": "After",
"sort": {
"x": 1
}
}
},
"outcome": {
"result": {
"x": 32
},
"collection": {
"data": [
{
"_id": 1,
"x": 11
},
{
"_id": 2,
"x": 32
},
{
"_id": 3,
"x": 33
}
]
}
}
},
{
"description": "FindOneAndReplace when one document matches returning the document before modification",
"operation": {
"name": "findOneAndReplace",
"arguments": {
"filter": {
"_id": 2
},
"replacement": {
"x": 32
},
"projection": {
"x": 1,
"_id": 0
},
"sort": {
"x": 1
}
}
},
"outcome": {
"result": {
"x": 22
},
"collection": {
"data": [
{
"_id": 1,
"x": 11
},
{
"_id": 2,
"x": 32
},
{
"_id": 3,
"x": 33
}
]
}
}
},
{
"description": "FindOneAndReplace when one document matches returning the document after modification",
"operation": {
"name": "findOneAndReplace",
"arguments": {
"filter": {
"_id": 2
},
"replacement": {
"x": 32
},
"projection": {
"x": 1,
"_id": 0
},
"returnDocument": "After",
"sort": {
"x": 1
}
}
},
"outcome": {
"result": {
"x": 32
},
"collection": {
"data": [
{
"_id": 1,
"x": 11
},
{
"_id": 2,
"x": 32
},
{
"_id": 3,
"x": 33
}
]
}
}
},
{
"description": "FindOneAndReplace when no documents match returning the document before modification",
"operation": {
"name": "findOneAndReplace",
"arguments": {
"filter": {
"_id": 4
},
"replacement": {
"x": 44
},
"projection": {
"x": 1,
"_id": 0
},
"sort": {
"x": 1
}
}
},
"outcome": {
"result": null,
"collection": {
"data": [
{
"_id": 1,
"x": 11
},
{
"_id": 2,
"x": 22
},
{
"_id": 3,
"x": 33
}
]
}
}
},
{
"description": "FindOneAndReplace when no documents match returning the document after modification",
"operation": {
"name": "findOneAndReplace",
"arguments": {
"filter": {
"_id": 4
},
"replacement": {
"x": 44
},
"projection": {
"x": 1,
"_id": 0
},
"returnDocument": "After",
"sort": {
"x": 1
}
}
},
"outcome": {
"result": null,
"collection": {
"data": [
{
"_id": 1,
"x": 11
},
{
"_id": 2,
"x": 22
},
{
"_id": 3,
"x": 33
}
]
}
}
}
]
}

View File

@ -1,203 +0,0 @@
{
"data": [
{
"_id": 1,
"y": [
{
"b": 3
},
{
"b": 1
}
]
},
{
"_id": 2,
"y": [
{
"b": 0
},
{
"b": 1
}
]
}
],
"minServerVersion": "3.5.6",
"tests": [
{
"description": "FindOneAndUpdate when no document matches arrayFilters",
"operation": {
"name": "findOneAndUpdate",
"arguments": {
"filter": {},
"update": {
"$set": {
"y.$[i].b": 2
}
},
"arrayFilters": [
{
"i.b": 4
}
]
}
},
"outcome": {
"result": {
"_id": 1,
"y": [
{
"b": 3
},
{
"b": 1
}
]
},
"collection": {
"data": [
{
"_id": 1,
"y": [
{
"b": 3
},
{
"b": 1
}
]
},
{
"_id": 2,
"y": [
{
"b": 0
},
{
"b": 1
}
]
}
]
}
}
},
{
"description": "FindOneAndUpdate when one document matches arrayFilters",
"operation": {
"name": "findOneAndUpdate",
"arguments": {
"filter": {},
"update": {
"$set": {
"y.$[i].b": 2
}
},
"arrayFilters": [
{
"i.b": 3
}
]
}
},
"outcome": {
"result": {
"_id": 1,
"y": [
{
"b": 3
},
{
"b": 1
}
]
},
"collection": {
"data": [
{
"_id": 1,
"y": [
{
"b": 2
},
{
"b": 1
}
]
},
{
"_id": 2,
"y": [
{
"b": 0
},
{
"b": 1
}
]
}
]
}
}
},
{
"description": "FindOneAndUpdate when multiple documents match arrayFilters",
"operation": {
"name": "findOneAndUpdate",
"arguments": {
"filter": {},
"update": {
"$set": {
"y.$[i].b": 2
}
},
"arrayFilters": [
{
"i.b": 1
}
]
}
},
"outcome": {
"result": {
"_id": 1,
"y": [
{
"b": 3
},
{
"b": 1
}
]
},
"collection": {
"data": [
{
"_id": 1,
"y": [
{
"b": 3
},
{
"b": 2
}
]
},
{
"_id": 2,
"y": [
{
"b": 0
},
{
"b": 1
}
]
}
]
}
}
}
]
}

View File

@ -1,68 +0,0 @@
{
"data": [
{
"_id": 1,
"x": 11
},
{
"_id": 2,
"x": "ping"
},
{
"_id": 3,
"x": "pINg"
}
],
"minServerVersion": "3.4",
"serverless": "forbid",
"tests": [
{
"description": "FindOneAndUpdate when many documents match with collation returning the document before modification",
"operation": {
"name": "findOneAndUpdate",
"arguments": {
"filter": {
"x": "PING"
},
"update": {
"$set": {
"x": "pong"
}
},
"projection": {
"x": 1,
"_id": 0
},
"sort": {
"_id": 1
},
"collation": {
"locale": "en_US",
"strength": 2
}
}
},
"outcome": {
"result": {
"x": "ping"
},
"collection": {
"data": [
{
"_id": 1,
"x": 11
},
{
"_id": 2,
"x": "pong"
},
{
"_id": 3,
"x": "pINg"
}
]
}
}
}
]
}

View File

@ -1,379 +0,0 @@
{
"data": [
{
"_id": 1,
"x": 11
},
{
"_id": 2,
"x": 22
},
{
"_id": 3,
"x": 33
}
],
"tests": [
{
"description": "FindOneAndUpdate when many documents match returning the document before modification",
"operation": {
"name": "findOneAndUpdate",
"arguments": {
"filter": {
"_id": {
"$gt": 1
}
},
"update": {
"$inc": {
"x": 1
}
},
"projection": {
"x": 1,
"_id": 0
},
"sort": {
"x": 1
}
}
},
"outcome": {
"result": {
"x": 22
},
"collection": {
"data": [
{
"_id": 1,
"x": 11
},
{
"_id": 2,
"x": 23
},
{
"_id": 3,
"x": 33
}
]
}
}
},
{
"description": "FindOneAndUpdate when many documents match returning the document after modification",
"operation": {
"name": "findOneAndUpdate",
"arguments": {
"filter": {
"_id": {
"$gt": 1
}
},
"update": {
"$inc": {
"x": 1
}
},
"projection": {
"x": 1,
"_id": 0
},
"returnDocument": "After",
"sort": {
"x": 1
}
}
},
"outcome": {
"result": {
"x": 23
},
"collection": {
"data": [
{
"_id": 1,
"x": 11
},
{
"_id": 2,
"x": 23
},
{
"_id": 3,
"x": 33
}
]
}
}
},
{
"description": "FindOneAndUpdate when one document matches returning the document before modification",
"operation": {
"name": "findOneAndUpdate",
"arguments": {
"filter": {
"_id": 2
},
"update": {
"$inc": {
"x": 1
}
},
"projection": {
"x": 1,
"_id": 0
},
"sort": {
"x": 1
}
}
},
"outcome": {
"result": {
"x": 22
},
"collection": {
"data": [
{
"_id": 1,
"x": 11
},
{
"_id": 2,
"x": 23
},
{
"_id": 3,
"x": 33
}
]
}
}
},
{
"description": "FindOneAndUpdate when one document matches returning the document after modification",
"operation": {
"name": "findOneAndUpdate",
"arguments": {
"filter": {
"_id": 2
},
"update": {
"$inc": {
"x": 1
}
},
"projection": {
"x": 1,
"_id": 0
},
"returnDocument": "After",
"sort": {
"x": 1
}
}
},
"outcome": {
"result": {
"x": 23
},
"collection": {
"data": [
{
"_id": 1,
"x": 11
},
{
"_id": 2,
"x": 23
},
{
"_id": 3,
"x": 33
}
]
}
}
},
{
"description": "FindOneAndUpdate when no documents match returning the document before modification",
"operation": {
"name": "findOneAndUpdate",
"arguments": {
"filter": {
"_id": 4
},
"update": {
"$inc": {
"x": 1
}
},
"projection": {
"x": 1,
"_id": 0
},
"sort": {
"x": 1
}
}
},
"outcome": {
"result": null,
"collection": {
"data": [
{
"_id": 1,
"x": 11
},
{
"_id": 2,
"x": 22
},
{
"_id": 3,
"x": 33
}
]
}
}
},
{
"description": "FindOneAndUpdate when no documents match with upsert returning the document before modification",
"operation": {
"name": "findOneAndUpdate",
"arguments": {
"filter": {
"_id": 4
},
"update": {
"$inc": {
"x": 1
}
},
"projection": {
"x": 1,
"_id": 0
},
"upsert": true
}
},
"outcome": {
"result": null,
"collection": {
"data": [
{
"_id": 1,
"x": 11
},
{
"_id": 2,
"x": 22
},
{
"_id": 3,
"x": 33
},
{
"_id": 4,
"x": 1
}
]
}
}
},
{
"description": "FindOneAndUpdate when no documents match returning the document after modification",
"operation": {
"name": "findOneAndUpdate",
"arguments": {
"filter": {
"_id": 4
},
"update": {
"$inc": {
"x": 1
}
},
"projection": {
"x": 1,
"_id": 0
},
"returnDocument": "After",
"sort": {
"x": 1
}
}
},
"outcome": {
"result": null,
"collection": {
"data": [
{
"_id": 1,
"x": 11
},
{
"_id": 2,
"x": 22
},
{
"_id": 3,
"x": 33
}
]
}
}
},
{
"description": "FindOneAndUpdate when no documents match with upsert returning the document after modification",
"operation": {
"name": "findOneAndUpdate",
"arguments": {
"filter": {
"_id": 4
},
"update": {
"$inc": {
"x": 1
}
},
"projection": {
"x": 1,
"_id": 0
},
"returnDocument": "After",
"sort": {
"x": 1
},
"upsert": true
}
},
"outcome": {
"result": {
"x": 1
},
"collection": {
"data": [
{
"_id": 1,
"x": 11
},
{
"_id": 2,
"x": 22
},
{
"_id": 3,
"x": 33
},
{
"_id": 4,
"x": 1
}
]
}
}
}
]
}

View File

@ -1,159 +0,0 @@
{
"data": [
{
"_id": 1,
"x": 11
}
],
"tests": [
{
"description": "InsertMany with non-existing documents",
"operation": {
"name": "insertMany",
"arguments": {
"documents": [
{
"_id": 2,
"x": 22
},
{
"_id": 3,
"x": 33
}
],
"options": {
"ordered": true
}
}
},
"outcome": {
"result": {
"insertedIds": {
"0": 2,
"1": 3
}
},
"collection": {
"data": [
{
"_id": 1,
"x": 11
},
{
"_id": 2,
"x": 22
},
{
"_id": 3,
"x": 33
}
]
}
}
},
{
"description": "InsertMany continue-on-error behavior with unordered (preexisting duplicate key)",
"operation": {
"name": "insertMany",
"arguments": {
"documents": [
{
"_id": 1,
"x": 11
},
{
"_id": 2,
"x": 22
},
{
"_id": 3,
"x": 33
}
],
"options": {
"ordered": false
}
}
},
"outcome": {
"error": true,
"result": {
"deletedCount": 0,
"insertedCount": 2,
"matchedCount": 0,
"modifiedCount": 0,
"upsertedCount": 0,
"upsertedIds": {}
},
"collection": {
"data": [
{
"_id": 1,
"x": 11
},
{
"_id": 2,
"x": 22
},
{
"_id": 3,
"x": 33
}
]
}
}
},
{
"description": "InsertMany continue-on-error behavior with unordered (duplicate key in requests)",
"operation": {
"name": "insertMany",
"arguments": {
"documents": [
{
"_id": 2,
"x": 22
},
{
"_id": 2,
"x": 22
},
{
"_id": 3,
"x": 33
}
],
"options": {
"ordered": false
}
}
},
"outcome": {
"error": true,
"result": {
"deletedCount": 0,
"insertedCount": 2,
"matchedCount": 0,
"modifiedCount": 0,
"upsertedCount": 0,
"upsertedIds": {}
},
"collection": {
"data": [
{
"_id": 1,
"x": 11
},
{
"_id": 2,
"x": 22
},
{
"_id": 3,
"x": 33
}
]
}
}
}
]
}

View File

@ -1,39 +0,0 @@
{
"data": [
{
"_id": 1,
"x": 11
}
],
"tests": [
{
"description": "InsertOne with a non-existing document",
"operation": {
"name": "insertOne",
"arguments": {
"document": {
"_id": 2,
"x": 22
}
}
},
"outcome": {
"result": {
"insertedId": 2
},
"collection": {
"data": [
{
"_id": 1,
"x": 11
},
{
"_id": 2,
"x": 22
}
]
}
}
}
]
}

View File

@ -1,54 +0,0 @@
{
"data": [
{
"_id": 1,
"x": 11
},
{
"_id": 2,
"x": "ping"
}
],
"minServerVersion": "3.4",
"serverless": "forbid",
"tests": [
{
"description": "ReplaceOne when one document matches with collation",
"operation": {
"name": "replaceOne",
"arguments": {
"filter": {
"x": "PING"
},
"replacement": {
"_id": 2,
"x": "pong"
},
"collation": {
"locale": "en_US",
"strength": 2
}
}
},
"outcome": {
"result": {
"matchedCount": 1,
"modifiedCount": 1,
"upsertedCount": 0
},
"collection": {
"data": [
{
"_id": 1,
"x": 11
},
{
"_id": 2,
"x": "pong"
}
]
}
}
}
]
}

View File

@ -1,205 +0,0 @@
{
"data": [
{
"_id": 1,
"x": 11
},
{
"_id": 2,
"x": 22
},
{
"_id": 3,
"x": 33
}
],
"minServerVersion": "2.6",
"tests": [
{
"description": "ReplaceOne when many documents match",
"operation": {
"name": "replaceOne",
"arguments": {
"filter": {
"_id": {
"$gt": 1
}
},
"replacement": {
"x": 111
}
}
},
"outcome": {
"result": {
"matchedCount": 1,
"modifiedCount": 1,
"upsertedCount": 0
}
}
},
{
"description": "ReplaceOne when one document matches",
"operation": {
"name": "replaceOne",
"arguments": {
"filter": {
"_id": 1
},
"replacement": {
"_id": 1,
"x": 111
}
}
},
"outcome": {
"result": {
"matchedCount": 1,
"modifiedCount": 1,
"upsertedCount": 0
},
"collection": {
"data": [
{
"_id": 1,
"x": 111
},
{
"_id": 2,
"x": 22
},
{
"_id": 3,
"x": 33
}
]
}
}
},
{
"description": "ReplaceOne when no documents match",
"operation": {
"name": "replaceOne",
"arguments": {
"filter": {
"_id": 4
},
"replacement": {
"_id": 4,
"x": 1
}
}
},
"outcome": {
"result": {
"matchedCount": 0,
"modifiedCount": 0,
"upsertedCount": 0
},
"collection": {
"data": [
{
"_id": 1,
"x": 11
},
{
"_id": 2,
"x": 22
},
{
"_id": 3,
"x": 33
}
]
}
}
},
{
"description": "ReplaceOne with upsert when no documents match without an id specified",
"operation": {
"name": "replaceOne",
"arguments": {
"filter": {
"_id": 4
},
"replacement": {
"x": 1
},
"upsert": true
}
},
"outcome": {
"result": {
"matchedCount": 0,
"modifiedCount": 0,
"upsertedCount": 1,
"upsertedId": 4
},
"collection": {
"data": [
{
"_id": 1,
"x": 11
},
{
"_id": 2,
"x": 22
},
{
"_id": 3,
"x": 33
},
{
"_id": 4,
"x": 1
}
]
}
}
},
{
"description": "ReplaceOne with upsert when no documents match with an id specified",
"operation": {
"name": "replaceOne",
"arguments": {
"filter": {
"_id": 4
},
"replacement": {
"_id": 4,
"x": 1
},
"upsert": true
}
},
"outcome": {
"result": {
"matchedCount": 0,
"modifiedCount": 0,
"upsertedCount": 1,
"upsertedId": 4
},
"collection": {
"data": [
{
"_id": 1,
"x": 11
},
{
"_id": 2,
"x": 22
},
{
"_id": 3,
"x": 33
},
{
"_id": 4,
"x": 1
}
]
}
}
}
]
}

View File

@ -1,185 +0,0 @@
{
"data": [
{
"_id": 1,
"y": [
{
"b": 3
},
{
"b": 1
}
]
},
{
"_id": 2,
"y": [
{
"b": 0
},
{
"b": 1
}
]
}
],
"minServerVersion": "3.5.6",
"tests": [
{
"description": "UpdateMany when no documents match arrayFilters",
"operation": {
"name": "updateMany",
"arguments": {
"filter": {},
"update": {
"$set": {
"y.$[i].b": 2
}
},
"arrayFilters": [
{
"i.b": 4
}
]
}
},
"outcome": {
"result": {
"matchedCount": 2,
"modifiedCount": 0,
"upsertedCount": 0
},
"collection": {
"data": [
{
"_id": 1,
"y": [
{
"b": 3
},
{
"b": 1
}
]
},
{
"_id": 2,
"y": [
{
"b": 0
},
{
"b": 1
}
]
}
]
}
}
},
{
"description": "UpdateMany when one document matches arrayFilters",
"operation": {
"name": "updateMany",
"arguments": {
"filter": {},
"update": {
"$set": {
"y.$[i].b": 2
}
},
"arrayFilters": [
{
"i.b": 3
}
]
}
},
"outcome": {
"result": {
"matchedCount": 2,
"modifiedCount": 1,
"upsertedCount": 0
},
"collection": {
"data": [
{
"_id": 1,
"y": [
{
"b": 2
},
{
"b": 1
}
]
},
{
"_id": 2,
"y": [
{
"b": 0
},
{
"b": 1
}
]
}
]
}
}
},
{
"description": "UpdateMany when multiple documents match arrayFilters",
"operation": {
"name": "updateMany",
"arguments": {
"filter": {},
"update": {
"$set": {
"y.$[i].b": 2
}
},
"arrayFilters": [
{
"i.b": 1
}
]
}
},
"outcome": {
"result": {
"matchedCount": 2,
"modifiedCount": 2,
"upsertedCount": 0
},
"collection": {
"data": [
{
"_id": 1,
"y": [
{
"b": 3
},
{
"b": 2
}
]
},
{
"_id": 2,
"y": [
{
"b": 0
},
{
"b": 2
}
]
}
]
}
}
}
]
}

View File

@ -1,63 +0,0 @@
{
"data": [
{
"_id": 1,
"x": 11
},
{
"_id": 2,
"x": "ping"
},
{
"_id": 3,
"x": "pINg"
}
],
"minServerVersion": "3.4",
"serverless": "forbid",
"tests": [
{
"description": "UpdateMany when many documents match with collation",
"operation": {
"name": "updateMany",
"arguments": {
"filter": {
"x": "ping"
},
"update": {
"$set": {
"x": "pong"
}
},
"collation": {
"locale": "en_US",
"strength": 2
}
}
},
"outcome": {
"result": {
"matchedCount": 2,
"modifiedCount": 2,
"upsertedCount": 0
},
"collection": {
"data": [
{
"_id": 1,
"x": 11
},
{
"_id": 2,
"x": "pong"
},
{
"_id": 3,
"x": "pong"
}
]
}
}
}
]
}

View File

@ -1,183 +0,0 @@
{
"data": [
{
"_id": 1,
"x": 11
},
{
"_id": 2,
"x": 22
},
{
"_id": 3,
"x": 33
}
],
"minServerVersion": "2.6",
"tests": [
{
"description": "UpdateMany when many documents match",
"operation": {
"name": "updateMany",
"arguments": {
"filter": {
"_id": {
"$gt": 1
}
},
"update": {
"$inc": {
"x": 1
}
}
}
},
"outcome": {
"result": {
"matchedCount": 2,
"modifiedCount": 2,
"upsertedCount": 0
},
"collection": {
"data": [
{
"_id": 1,
"x": 11
},
{
"_id": 2,
"x": 23
},
{
"_id": 3,
"x": 34
}
]
}
}
},
{
"description": "UpdateMany when one document matches",
"operation": {
"name": "updateMany",
"arguments": {
"filter": {
"_id": 1
},
"update": {
"$inc": {
"x": 1
}
}
}
},
"outcome": {
"result": {
"matchedCount": 1,
"modifiedCount": 1,
"upsertedCount": 0
},
"collection": {
"data": [
{
"_id": 1,
"x": 12
},
{
"_id": 2,
"x": 22
},
{
"_id": 3,
"x": 33
}
]
}
}
},
{
"description": "UpdateMany when no documents match",
"operation": {
"name": "updateMany",
"arguments": {
"filter": {
"_id": 4
},
"update": {
"$inc": {
"x": 1
}
}
}
},
"outcome": {
"result": {
"matchedCount": 0,
"modifiedCount": 0,
"upsertedCount": 0
},
"collection": {
"data": [
{
"_id": 1,
"x": 11
},
{
"_id": 2,
"x": 22
},
{
"_id": 3,
"x": 33
}
]
}
}
},
{
"description": "UpdateMany with upsert when no documents match",
"operation": {
"name": "updateMany",
"arguments": {
"filter": {
"_id": 4
},
"update": {
"$inc": {
"x": 1
}
},
"upsert": true
}
},
"outcome": {
"result": {
"matchedCount": 0,
"modifiedCount": 0,
"upsertedCount": 1,
"upsertedId": 4
},
"collection": {
"data": [
{
"_id": 1,
"x": 11
},
{
"_id": 2,
"x": 22
},
{
"_id": 3,
"x": 33
},
{
"_id": 4,
"x": 1
}
]
}
}
}
]
}

View File

@ -1,55 +0,0 @@
{
"data": [
{
"_id": 1,
"x": 11
},
{
"_id": 2,
"x": "ping"
}
],
"minServerVersion": "3.4",
"serverless": "forbid",
"tests": [
{
"description": "UpdateOne when one document matches with collation",
"operation": {
"name": "updateOne",
"arguments": {
"filter": {
"x": "PING"
},
"update": {
"$set": {
"x": "pong"
}
},
"collation": {
"locale": "en_US",
"strength": 2
}
}
},
"outcome": {
"result": {
"matchedCount": 1,
"modifiedCount": 1,
"upsertedCount": 0
},
"collection": {
"data": [
{
"_id": 1,
"x": 11
},
{
"_id": 2,
"x": "pong"
}
]
}
}
}
]
}

View File

@ -1,167 +0,0 @@
{
"data": [
{
"_id": 1,
"x": 11
},
{
"_id": 2,
"x": 22
},
{
"_id": 3,
"x": 33
}
],
"minServerVersion": "2.6",
"tests": [
{
"description": "UpdateOne when many documents match",
"operation": {
"name": "updateOne",
"arguments": {
"filter": {
"_id": {
"$gt": 1
}
},
"update": {
"$inc": {
"x": 1
}
}
}
},
"outcome": {
"result": {
"matchedCount": 1,
"modifiedCount": 1,
"upsertedCount": 0
}
}
},
{
"description": "UpdateOne when one document matches",
"operation": {
"name": "updateOne",
"arguments": {
"filter": {
"_id": 1
},
"update": {
"$inc": {
"x": 1
}
}
}
},
"outcome": {
"result": {
"matchedCount": 1,
"modifiedCount": 1,
"upsertedCount": 0
},
"collection": {
"data": [
{
"_id": 1,
"x": 12
},
{
"_id": 2,
"x": 22
},
{
"_id": 3,
"x": 33
}
]
}
}
},
{
"description": "UpdateOne when no documents match",
"operation": {
"name": "updateOne",
"arguments": {
"filter": {
"_id": 4
},
"update": {
"$inc": {
"x": 1
}
}
}
},
"outcome": {
"result": {
"matchedCount": 0,
"modifiedCount": 0,
"upsertedCount": 0
},
"collection": {
"data": [
{
"_id": 1,
"x": 11
},
{
"_id": 2,
"x": 22
},
{
"_id": 3,
"x": 33
}
]
}
}
},
{
"description": "UpdateOne with upsert when no documents match",
"operation": {
"name": "updateOne",
"arguments": {
"filter": {
"_id": 4
},
"update": {
"$inc": {
"x": 1
}
},
"upsert": true
}
},
"outcome": {
"result": {
"matchedCount": 0,
"modifiedCount": 0,
"upsertedCount": 1,
"upsertedId": 4
},
"collection": {
"data": [
{
"_id": 1,
"x": 11
},
{
"_id": 2,
"x": 22
},
{
"_id": 3,
"x": 33
},
{
"_id": 4,
"x": 1
}
]
}
}
}
]
}

View File

@ -15,21 +15,12 @@
"""Test the collection module."""
from __future__ import annotations
import os
import sys
sys.path[0:0] = [""]
from test import IntegrationTest, drop_collections, unittest
from test.utils import (
SpecTestCreator,
camel_to_snake,
camel_to_snake_args,
camel_to_upper_camel,
)
from test import unittest
from pymongo import WriteConcern, operations
from pymongo.errors import PyMongoError
from pymongo.operations import (
DeleteMany,
DeleteOne,
@ -38,141 +29,6 @@ from pymongo.operations import (
UpdateMany,
UpdateOne,
)
from pymongo.read_concern import ReadConcern
from pymongo.results import BulkWriteResult, _WriteResult
from pymongo.synchronous.command_cursor import CommandCursor
from pymongo.synchronous.cursor import Cursor
# Location of JSON test specifications.
_TEST_PATH = os.path.join(os.path.dirname(os.path.realpath(__file__)), "crud", "v1")
class TestAllScenarios(IntegrationTest):
RUN_ON_SERVERLESS = True
def check_result(self, expected_result, result):
if isinstance(result, _WriteResult):
for res in expected_result:
prop = camel_to_snake(res)
msg = f"{prop} : {expected_result!r} != {result!r}"
# SPEC-869: Only BulkWriteResult has upserted_count.
if prop == "upserted_count" and not isinstance(result, BulkWriteResult):
if result.upserted_id is not None: # type: ignore
upserted_count = 1
else:
upserted_count = 0
self.assertEqual(upserted_count, expected_result[res], msg)
elif prop == "inserted_ids":
# BulkWriteResult does not have inserted_ids.
if isinstance(result, BulkWriteResult):
self.assertEqual(len(expected_result[res]), result.inserted_count)
else:
# InsertManyResult may be compared to [id1] from the
# crud spec or {"0": id1} from the retryable write spec.
ids = expected_result[res]
if isinstance(ids, dict):
ids = [ids[str(i)] for i in range(len(ids))]
self.assertEqual(ids, result.inserted_ids, msg) # type: ignore
elif prop == "upserted_ids":
# Convert indexes from strings to integers.
ids = expected_result[res]
expected_ids = {}
for str_index in ids:
expected_ids[int(str_index)] = ids[str_index]
self.assertEqual(expected_ids, result.upserted_ids, msg) # type: ignore
else:
self.assertEqual(getattr(result, prop), expected_result[res], msg)
else:
self.assertEqual(result, expected_result)
def run_operation(collection, test):
# Convert command from CamelCase to pymongo.collection method.
operation = camel_to_snake(test["operation"]["name"])
cmd = getattr(collection, operation)
# Convert arguments to snake_case and handle special cases.
arguments = test["operation"]["arguments"]
options = arguments.pop("options", {})
for option_name in options:
arguments[camel_to_snake(option_name)] = options[option_name]
if operation == "count":
raise unittest.SkipTest("PyMongo does not support count")
if operation == "bulk_write":
# Parse each request into a bulk write model.
requests = []
for request in arguments["requests"]:
bulk_model = camel_to_upper_camel(request["name"])
bulk_class = getattr(operations, bulk_model)
bulk_arguments = camel_to_snake_args(request["arguments"])
requests.append(bulk_class(**bulk_arguments))
arguments["requests"] = requests
else:
for arg_name in list(arguments):
c2s = camel_to_snake(arg_name)
# PyMongo accepts sort as list of tuples.
if arg_name == "sort":
sort_dict = arguments[arg_name]
arguments[arg_name] = list(sort_dict.items())
# Named "key" instead not fieldName.
if arg_name == "fieldName":
arguments["key"] = arguments.pop(arg_name)
# Aggregate uses "batchSize", while find uses batch_size.
elif arg_name == "batchSize" and operation == "aggregate":
continue
# Requires boolean returnDocument.
elif arg_name == "returnDocument":
arguments[c2s] = arguments.pop(arg_name) == "After"
else:
arguments[c2s] = arguments.pop(arg_name)
result = cmd(**arguments)
if isinstance(result, Cursor) or isinstance(result, CommandCursor):
return list(result)
return result
def create_test(scenario_def, test, name):
def run_scenario(self):
# Cleanup state and load data (if provided).
drop_collections(self.db)
data = scenario_def.get("data")
if data:
self.db.test.with_options(write_concern=WriteConcern(w="majority")).insert_many(
scenario_def["data"]
)
# Run operations and check results or errors.
expected_result = test.get("outcome", {}).get("result")
expected_error = test.get("outcome", {}).get("error")
if expected_error is True:
with self.assertRaises(PyMongoError):
run_operation(self.db.test, test)
else:
result = run_operation(self.db.test, test)
if expected_result is not None:
check_result(self, expected_result, result)
# Assert final state is expected.
expected_c = test["outcome"].get("collection")
if expected_c is not None:
expected_name = expected_c.get("name")
if expected_name is not None:
db_coll = self.db[expected_name]
else:
db_coll = self.db.test
db_coll = db_coll.with_options(read_concern=ReadConcern(level="local"))
self.assertEqual(list(db_coll.find()), expected_c["data"])
return run_scenario
test_creator = SpecTestCreator(create_test, TestAllScenarios, _TEST_PATH)
test_creator.create_tests()
class TestWriteOpsComparison(unittest.TestCase):