...

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

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

     1description: "find-let"
     2
     3schemaVersion: "1.0"
     4
     5createEntities:
     6  - client:
     7      id: &client0 client0
     8      observeEvents: [ commandStartedEvent ]
     9  - database:
    10      id: &database0 database0
    11      client: *client0
    12      databaseName: &database0Name crud-tests
    13  - collection:
    14      id: &collection0 collection0
    15      database: *database0
    16      collectionName: &collection0Name coll0
    17
    18initialData: &initialData
    19  - collectionName: *collection0Name
    20    databaseName: *database0Name
    21    documents:
    22      - { _id: 1 }
    23      - { _id: 2 }
    24
    25tests:
    26  - description: "Find with let option"
    27    runOnRequirements:
    28      - minServerVersion: "5.0"
    29    operations:
    30      - name: find
    31        object: *collection0
    32        arguments:
    33          filter: &filter
    34            $expr:
    35              $eq: [ "$_id", "$$id" ]
    36          let: &let0
    37            id: 1
    38        expectResult:
    39          - { _id: 1 }
    40    expectEvents:
    41      - client: *client0
    42        events:
    43          - commandStartedEvent:
    44              command:
    45                find: *collection0Name
    46                filter: *filter
    47                let: *let0
    48
    49  - description: "Find with let option unsupported (server-side error)"
    50    runOnRequirements:
    51      - minServerVersion: "3.6.0"
    52        maxServerVersion: "4.4.99"
    53    operations:
    54      - name: find
    55        object: *collection0
    56        arguments:
    57          filter: &filter1
    58            _id: 1
    59          let: &let1
    60            x: 1
    61        expectError:
    62          errorContains: "Unrecognized field 'let'"
    63          isClientError: false
    64    expectEvents:
    65      - client: *client0
    66        events:
    67          - commandStartedEvent:
    68              command:
    69                find: *collection0Name
    70                filter: *filter1
    71                let: *let1

View as plain text