description: matches-lte-operator

schemaVersion: '1.5'

createEntities:
  - client:
      id: &client0 client0
      observeEvents: [ commandStartedEvent ]
  - database:
      id: &database0 database0
      client: *client0
      databaseName: &database0Name database0Name
  - collection:
      id: &collection0 collection0
      database: *database0
      collectionName: &collection0Name coll0

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

tests:
  - description: special lte matching operator
    operations:
      - name: insertOne
        object: *collection0
        arguments:
          document: { _id : 1, y: 1 }
    expectEvents:
      - client: *client0
        events:
          - commandStartedEvent:
              command:
                insert: *collection0Name
                documents:
                  # We can make exact assertions here but we use the $$lte operator to ensure drivers support it.
                  - { _id: { $$lte: 1 }, y: { $$lte: 2 } }
              commandName: insert
              databaseName: *database0Name