...

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

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

     1description: "find-comment"
     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, x: 11 }
    23      - { _id: 2, x: 22 }
    24      - { _id: 3, x: 33 }
    25      - { _id: 4, x: 44 }
    26      - { _id: 5, x: 55 }
    27      - { _id: 6, x: 66 }
    28
    29tests:
    30  - description: "find with string comment"
    31    runOnRequirements:
    32      - minServerVersion: "3.6"
    33    operations:
    34      - name: find
    35        object: *collection0
    36        arguments:
    37          filter: &filter
    38            _id: 1
    39          comment: "comment"
    40        expectResult: &expect_result
    41          - { _id: 1 }
    42    expectEvents:
    43      - client: *client0
    44        events:
    45          - commandStartedEvent:
    46              command:
    47                find: *collection0Name
    48                filter: *filter
    49                comment: "comment"
    50
    51  - description: "find with document comment"
    52    runOnRequirements:
    53      - minServerVersion: "4.4"
    54    operations:
    55      - name: find
    56        object: *collection0
    57        arguments:
    58          filter: *filter
    59          comment: &comment { key: "value"}
    60        expectResult: *expect_result
    61    expectEvents:
    62      - client: *client0
    63        events:
    64          - commandStartedEvent:
    65              command:
    66                find: *collection0Name
    67                filter: *filter
    68                comment: *comment
    69
    70  - description: "find with document comment - pre 4.4"
    71    runOnRequirements:
    72      - maxServerVersion: "4.2.99"
    73        minServerVersion: "3.6"
    74    operations:
    75      - name: find
    76        object: *collection0
    77        arguments:
    78          filter: *filter
    79          comment: *comment
    80        expectError:
    81          isClientError: false
    82    expectEvents:
    83      - client: *client0
    84        events:
    85          - commandStartedEvent:
    86              command:
    87                find: *collection0Name
    88                filter: *filter
    89                comment: *comment
    90
    91  - description: "find with comment sets comment on getMore"
    92    runOnRequirements:
    93      - minServerVersion: "4.4.0"
    94    operations:
    95      - name: find
    96        object: *collection0
    97        arguments:
    98          filter: &filter_get_more { _id: { $gt: 1 } }
    99          batchSize: 2
   100          comment: *comment
   101        expectResult:
   102          - { _id: 2, x: 22 }
   103          - { _id: 3, x: 33 }
   104          - { _id: 4, x: 44 }
   105          - { _id: 5, x: 55 }
   106          - { _id: 6, x: 66 }
   107    expectEvents:
   108      - client: *client0
   109        events:
   110          - commandStartedEvent:
   111              command:
   112                find: *collection0Name
   113                filter: { _id: { $gt: 1 } }
   114                batchSize: 2
   115                comment: *comment
   116          - commandStartedEvent:
   117              command:
   118                getMore: { $$type: [ int, long ] }
   119                collection: *collection0Name
   120                batchSize: 2
   121                comment: *comment
   122          - commandStartedEvent:
   123              command:
   124                getMore: { $$type: [ int, long ] }
   125                collection: *collection0Name
   126                batchSize: 2
   127                comment: *comment
   128
   129  - description: "find with comment does not set comment on getMore - pre 4.4"
   130    runOnRequirements:
   131      - minServerVersion: "3.6.0"
   132        maxServerVersion: "4.3.99"
   133    operations:
   134      - name: find
   135        object: *collection0
   136        arguments:
   137          filter: &filter_get_more { _id: { $gt: 1 } }
   138          batchSize: 2
   139          comment: "comment"
   140        expectResult:
   141          - { _id: 2, x: 22 }
   142          - { _id: 3, x: 33 }
   143          - { _id: 4, x: 44 }
   144          - { _id: 5, x: 55 }
   145          - { _id: 6, x: 66 }
   146    expectEvents:
   147      - client: *client0
   148        events:
   149          - commandStartedEvent:
   150              command:
   151                find: *collection0Name
   152                filter: { _id: { $gt: 1 } }
   153                batchSize: 2
   154                comment: "comment"
   155          - commandStartedEvent:
   156              command:
   157                getMore: { $$type: [ int, long ] }
   158                collection: *collection0Name
   159                batchSize: 2
   160                comment: { $$exists: false }
   161          - commandStartedEvent:
   162              command:
   163                getMore: { $$type: [ int, long ] }
   164                collection: *collection0Name
   165                batchSize: 2
   166                comment: { $$exists: false }

View as plain text