bson/testdata/command-monitoring/insertMany.json
2025-03-17 20:58:26 +01:00

149 lines
3.2 KiB
JSON

{
"description": "insertMany",
"schemaVersion": "1.0",
"createEntities": [
{
"client": {
"id": "client",
"observeEvents": [
"commandStartedEvent",
"commandSucceededEvent",
"commandFailedEvent"
]
}
},
{
"database": {
"id": "database",
"client": "client",
"databaseName": "command-monitoring-tests"
}
},
{
"collection": {
"id": "collection",
"database": "database",
"collectionName": "test"
}
}
],
"initialData": [
{
"collectionName": "test",
"databaseName": "command-monitoring-tests",
"documents": [
{
"_id": 1,
"x": 11
}
]
}
],
"tests": [
{
"description": "A successful insertMany",
"operations": [
{
"name": "insertMany",
"object": "collection",
"arguments": {
"documents": [
{
"_id": 2,
"x": 22
}
]
}
}
],
"expectEvents": [
{
"client": "client",
"events": [
{
"commandStartedEvent": {
"command": {
"insert": "test",
"documents": [
{
"_id": 2,
"x": 22
}
],
"ordered": true
},
"commandName": "insert",
"databaseName": "command-monitoring-tests"
}
},
{
"commandSucceededEvent": {
"reply": {
"ok": 1,
"n": 1
},
"commandName": "insert"
}
}
]
}
]
},
{
"description": "A successful insertMany with write errors",
"operations": [
{
"name": "insertMany",
"object": "collection",
"arguments": {
"documents": [
{
"_id": 1,
"x": 11
}
]
},
"expectError": {
"isClientError": false
}
}
],
"expectEvents": [
{
"client": "client",
"events": [
{
"commandStartedEvent": {
"command": {
"insert": "test",
"documents": [
{
"_id": 1,
"x": 11
}
],
"ordered": true
},
"commandName": "insert",
"databaseName": "command-monitoring-tests"
}
},
{
"commandSucceededEvent": {
"reply": {
"ok": 1,
"n": 0,
"writeErrors": {
"$$type": "array"
}
},
"commandName": "insert"
}
}
]
}
]
}
]
}