...

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

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

     1description: entity-find-cursor
     2
     3schemaVersion: '1.3'
     4
     5createEntities:
     6  - client:
     7      id: &client0 client0
     8      observeEvents:
     9        - commandStartedEvent
    10        - commandSucceededEvent
    11        - commandFailedEvent
    12  - database:
    13      id: &database0 database0
    14      client: *client0
    15      databaseName: &database0Name database0Name
    16  - collection:
    17      id: &collection0 collection0
    18      database: *database0
    19      collectionName: &collection0Name coll0
    20
    21initialData:
    22  - databaseName: *database0Name
    23    collectionName: *collection0Name
    24    documents:
    25      - _id: 1
    26      - _id: 2
    27      - _id: 3
    28      - _id: 4
    29      - _id: 5
    30
    31tests:
    32  - description: cursors can be created, iterated, and closed
    33    operations:
    34      - name: createFindCursor
    35        object: *collection0
    36        arguments:
    37          filter: {}
    38          batchSize: 2
    39        saveResultAsEntity: &cursor0 cursor0
    40      - name: iterateUntilDocumentOrError
    41        object: *cursor0
    42        expectResult: { _id: 1 }
    43      - name: iterateUntilDocumentOrError
    44        object: *cursor0
    45        expectResult: { _id: 2 }
    46      - name: iterateUntilDocumentOrError
    47        object: *cursor0
    48        expectResult: { _id: 3 }
    49      - name: close
    50        object: *cursor0
    51    expectEvents:
    52      - client: *client0
    53        events:
    54          - commandStartedEvent:
    55              command:
    56                find: *collection0Name
    57                filter: {}
    58                batchSize: 2
    59              commandName: find
    60              databaseName: *database0Name
    61          - commandSucceededEvent:
    62              reply:
    63                cursor:
    64                  id: { $$type: long }
    65                  ns: { $$type: string }
    66                  firstBatch: { $$type: array } 
    67              commandName: find
    68          - commandStartedEvent:
    69              command:
    70                getMore: { $$type: long }
    71                collection: *collection0Name
    72              commandName: getMore
    73          - commandSucceededEvent:
    74              reply:
    75                cursor:
    76                  id: { $$type: long }
    77                  ns: { $$type: string }
    78                  nextBatch: { $$type: array } 
    79              commandName: getMore
    80          - commandStartedEvent:
    81              command:
    82                killCursors: *collection0Name
    83                cursors: { $$type: array }
    84              commandName: killCursors
    85          - commandSucceededEvent:
    86              reply:
    87                # No cursorsKilled field expected on pre-3.2 servers
    88                cursorsKilled: { $$unsetOrMatches: { $$type: array } }
    89              commandName: killCursors

View as plain text