bson/testdata/crud/unified/find-comment.json
2025-03-17 20:58:26 +01:00

404 lines
8.4 KiB
JSON

{
"description": "find-comment",
"schemaVersion": "1.0",
"createEntities": [
{
"client": {
"id": "client0",
"observeEvents": [
"commandStartedEvent"
]
}
},
{
"database": {
"id": "database0",
"client": "client0",
"databaseName": "crud-tests"
}
},
{
"collection": {
"id": "collection0",
"database": "database0",
"collectionName": "coll0"
}
}
],
"initialData": [
{
"collectionName": "coll0",
"databaseName": "crud-tests",
"documents": [
{
"_id": 1,
"x": 11
},
{
"_id": 2,
"x": 22
},
{
"_id": 3,
"x": 33
},
{
"_id": 4,
"x": 44
},
{
"_id": 5,
"x": 55
},
{
"_id": 6,
"x": 66
}
]
}
],
"tests": [
{
"description": "find with string comment",
"runOnRequirements": [
{
"minServerVersion": "3.6"
}
],
"operations": [
{
"name": "find",
"object": "collection0",
"arguments": {
"filter": {
"_id": 1
},
"comment": "comment"
},
"expectResult": [
{
"_id": 1
}
]
}
],
"expectEvents": [
{
"client": "client0",
"events": [
{
"commandStartedEvent": {
"command": {
"find": "coll0",
"filter": {
"_id": 1
},
"comment": "comment"
}
}
}
]
}
]
},
{
"description": "find with document comment",
"runOnRequirements": [
{
"minServerVersion": "4.4"
}
],
"operations": [
{
"name": "find",
"object": "collection0",
"arguments": {
"filter": {
"_id": 1
},
"comment": {
"key": "value"
}
},
"expectResult": [
{
"_id": 1
}
]
}
],
"expectEvents": [
{
"client": "client0",
"events": [
{
"commandStartedEvent": {
"command": {
"find": "coll0",
"filter": {
"_id": 1
},
"comment": {
"key": "value"
}
}
}
}
]
}
]
},
{
"description": "find with document comment - pre 4.4",
"runOnRequirements": [
{
"maxServerVersion": "4.2.99",
"minServerVersion": "3.6"
}
],
"operations": [
{
"name": "find",
"object": "collection0",
"arguments": {
"filter": {
"_id": 1
},
"comment": {
"key": "value"
}
},
"expectError": {
"isClientError": false
}
}
],
"expectEvents": [
{
"client": "client0",
"events": [
{
"commandStartedEvent": {
"command": {
"find": "coll0",
"filter": {
"_id": 1
},
"comment": {
"key": "value"
}
}
}
}
]
}
]
},
{
"description": "find with comment sets comment on getMore",
"runOnRequirements": [
{
"minServerVersion": "4.4.0"
}
],
"operations": [
{
"name": "find",
"object": "collection0",
"arguments": {
"filter": {
"_id": {
"$gt": 1
}
},
"batchSize": 2,
"comment": {
"key": "value"
}
},
"expectResult": [
{
"_id": 2,
"x": 22
},
{
"_id": 3,
"x": 33
},
{
"_id": 4,
"x": 44
},
{
"_id": 5,
"x": 55
},
{
"_id": 6,
"x": 66
}
]
}
],
"expectEvents": [
{
"client": "client0",
"events": [
{
"commandStartedEvent": {
"command": {
"find": "coll0",
"filter": {
"_id": {
"$gt": 1
}
},
"batchSize": 2,
"comment": {
"key": "value"
}
}
}
},
{
"commandStartedEvent": {
"command": {
"getMore": {
"$$type": [
"int",
"long"
]
},
"collection": "coll0",
"batchSize": 2,
"comment": {
"key": "value"
}
}
}
},
{
"commandStartedEvent": {
"command": {
"getMore": {
"$$type": [
"int",
"long"
]
},
"collection": "coll0",
"batchSize": 2,
"comment": {
"key": "value"
}
}
}
}
]
}
]
},
{
"description": "find with comment does not set comment on getMore - pre 4.4",
"runOnRequirements": [
{
"minServerVersion": "3.6.0",
"maxServerVersion": "4.3.99"
}
],
"operations": [
{
"name": "find",
"object": "collection0",
"arguments": {
"filter": {
"_id": {
"$gt": 1
}
},
"batchSize": 2,
"comment": "comment"
},
"expectResult": [
{
"_id": 2,
"x": 22
},
{
"_id": 3,
"x": 33
},
{
"_id": 4,
"x": 44
},
{
"_id": 5,
"x": 55
},
{
"_id": 6,
"x": 66
}
]
}
],
"expectEvents": [
{
"client": "client0",
"events": [
{
"commandStartedEvent": {
"command": {
"find": "coll0",
"filter": {
"_id": {
"$gt": 1
}
},
"batchSize": 2,
"comment": "comment"
}
}
},
{
"commandStartedEvent": {
"command": {
"getMore": {
"$$type": [
"int",
"long"
]
},
"collection": "coll0",
"batchSize": 2,
"comment": {
"$$exists": false
}
}
}
},
{
"commandStartedEvent": {
"command": {
"getMore": {
"$$type": [
"int",
"long"
]
},
"collection": "coll0",
"batchSize": 2,
"comment": {
"$$exists": false
}
}
}
}
]
}
]
}
]
}