{
  "description": "server-connection-id",
  "schemaVersion": "1.6",
  "runOnRequirements": [
    {
      "minServerVersion": "4.2"
    }
  ],
  "createEntities": [
    {
      "client": {
        "id": "client",
        "observeEvents": [
          "commandStartedEvent",
          "commandSucceededEvent",
          "commandFailedEvent"
        ]
      }
    },
    {
      "database": {
        "id": "database",
        "client": "client",
        "databaseName": "server-connection-id-tests"
      }
    },
    {
      "collection": {
        "id": "collection",
        "database": "database",
        "collectionName": "coll"
      }
    }
  ],
  "initialData": [
    {
      "databaseName": "server-connection-id-tests",
      "collectionName": "coll",
      "documents": []
    }
  ],
  "tests": [
    {
      "description": "command events include server connection id",
      "operations": [
        {
          "name": "insertOne",
          "object": "collection",
          "arguments": {
            "document": {
              "x": 1
            }
          }
        },
        {
          "name": "find",
          "object": "collection",
          "arguments": {
            "filter": {
              "$or": true
            }
          },
          "expectError": {
            "isError": true
          }
        }
      ],
      "expectEvents": [
        {
          "client": "client",
          "events": [
            {
              "commandStartedEvent": {
                "commandName": "insert",
                "hasServerConnectionId": true
              }
            },
            {
              "commandSucceededEvent": {
                "commandName": "insert",
                "hasServerConnectionId": true
              }
            },
            {
              "commandStartedEvent": {
                "commandName": "find",
                "hasServerConnectionId": true
              }
            },
            {
              "commandFailedEvent": {
                "commandName": "find",
                "hasServerConnectionId": true
              }
            }
          ]
        }
      ]
    }
  ]
}
