description: "pre-42-server-connection-id"

schemaVersion: "1.6"

runOnRequirements:
  - maxServerVersion: "4.0.99"

createEntities:
  - client:
      id: &client client
      observeEvents:
        - commandStartedEvent
        - commandSucceededEvent
        - commandFailedEvent
  - database:
      id: &database database
      client: *client
      databaseName: &databaseName server-connection-id-tests
  - collection:
      id: &collection collection
      database: *database
      collectionName: &collectionName coll

initialData:
  - databaseName: *databaseName
    collectionName: *collectionName
    documents: []

tests:
  - description: "command events do not 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: false
          - commandSucceededEvent:
              commandName: insert
              hasServerConnectionId: false
          - commandStartedEvent:
              commandName: find
              hasServerConnectionId: false
          - commandFailedEvent:
              commandName: find
              hasServerConnectionId: false
