...

Text file src/go.mongodb.org/mongo-driver/testdata/unified-test-format/valid-pass/entity-cursor-iterateOnce.yml

Documentation: go.mongodb.org/mongo-driver/testdata/unified-test-format/valid-pass

     1description: entity-cursor-iterateOnce
     2
     3schemaVersion: '1.5'
     4
     5createEntities:
     6  - client:
     7      id: &client0 client0
     8      observeEvents: [ commandStartedEvent ]
     9  - database:
    10      id: &database0 database0
    11      client: *client0
    12      databaseName: &database0Name database0
    13  - collection:
    14      id: &collection0 collection0
    15      database: *database0
    16      collectionName: &collection0Name coll0
    17
    18initialData:
    19  - databaseName: *database0Name
    20    collectionName: *collection0Name
    21    documents:
    22      - _id: 1
    23      - _id: 2
    24      - _id: 3
    25
    26tests:
    27  - description: iterateOnce
    28    operations:
    29      - name: createFindCursor
    30        object: *collection0
    31        arguments:
    32          filter: {}
    33          batchSize: 2
    34        saveResultAsEntity: &cursor0 cursor0
    35      - name: iterateUntilDocumentOrError
    36        object: *cursor0
    37        expectResult: { _id: 1 }
    38      - name: iterateUntilDocumentOrError
    39        object: *cursor0
    40        expectResult: { _id: 2 }
    41      # This operation could be iterateUntilDocumentOrError, but we use iterateOne to ensure that drivers support it.
    42      - name: iterateOnce
    43        object: *cursor0
    44    expectEvents:
    45      - client: *client0
    46        events:
    47          - commandStartedEvent:
    48              command:
    49                find: *collection0Name
    50                filter: {}
    51                batchSize: 2
    52              commandName: find
    53              databaseName: *database0Name
    54          - commandStartedEvent:
    55              command:
    56                getMore: { $$type: long }
    57                collection: *collection0Name
    58              commandName: getMore

View as plain text