...

Text file src/go.mongodb.org/mongo-driver/testdata/crud/unified/find.yml

Documentation: go.mongodb.org/mongo-driver/testdata/crud/unified

     1description: "find"
     2
     3schemaVersion: "1.0"
     4
     5createEntities:
     6  - client:
     7      id: &client0 client0
     8      useMultipleMongoses: true # ensure cursors pin to a single server
     9      observeEvents: [ commandStartedEvent ]
    10  - database:
    11      id: &database0 database0
    12      client: *client0
    13      databaseName: &database0Name find-tests
    14  - collection:
    15      id: &collection0 collection0
    16      database: *database0
    17      collectionName: &collection0Name coll0
    18
    19initialData:
    20  - collectionName: *collection0Name
    21    databaseName: *database0Name
    22    documents:
    23      - { _id: 1, x: 11 }
    24      - { _id: 2, x: 22 }
    25      - { _id: 3, x: 33 }
    26      - { _id: 4, x: 44 }
    27      - { _id: 5, x: 55 }
    28      - { _id: 6, x: 66 }
    29
    30tests:
    31  - description: "find with multiple batches works"
    32    operations:
    33      - name: find
    34        arguments:
    35          filter: { _id: { $gt: 1 } }
    36          batchSize: 2
    37        object: *collection0
    38        expectResult:
    39          - { _id: 2, x: 22 }
    40          - { _id: 3, x: 33 }
    41          - { _id: 4, x: 44 }
    42          - { _id: 5, x: 55 }
    43          - { _id: 6, x: 66 }
    44    expectEvents:
    45      - client: *client0
    46        events:
    47          - commandStartedEvent:
    48              command:
    49                find: *collection0Name
    50                filter: { _id: { $gt: 1 } }
    51                batchSize: 2
    52              commandName: find
    53              databaseName: *database0Name
    54          - commandStartedEvent:
    55              command:
    56                getMore: { $$type: [ int, long ] }
    57                collection: *collection0Name
    58                batchSize: 2
    59              commandName: getMore
    60              databaseName: *database0Name
    61          - commandStartedEvent:
    62              command:
    63                getMore: { $$type: [ int, long ] }
    64                collection: *collection0Name
    65                batchSize: 2
    66              commandName: getMore
    67              databaseName: *database0Name
    68

View as plain text