...

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

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

     1description: "countDocuments-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 countDocuments-comments-test
    13  - collection:
    14      id: &collection0 collection0
    15      database: *database0
    16      collectionName: &collection0Name coll0
    17
    18initialData:
    19  - collectionName: *collection0Name
    20    databaseName: *database0Name
    21    documents:
    22      - { _id: 1, x: 11 }
    23      - { _id: 2, x: 22 }
    24      - { _id: 3, x: 33 }
    25
    26tests:
    27  - description: "countDocuments with document comment"
    28    runOnRequirements:
    29      - minServerVersion: 4.4.0
    30    operations:
    31      - name: countDocuments
    32        object: *collection0
    33        arguments:
    34          filter: {}
    35          comment: &documentComment { key: "value" }
    36        expectResult: 3
    37    expectEvents:
    38      - client: *client0
    39        events:
    40          - commandStartedEvent:
    41              command:
    42                aggregate: *collection0Name
    43                pipeline: &pipeline
    44                  - $match: {}
    45                  - $group: { _id: 1, n: { $sum: 1 } }
    46                comment: *documentComment
    47              commandName: aggregate
    48              databaseName: *database0Name
    49
    50  - description: "countDocuments with string comment"
    51    runOnRequirements:
    52      - minServerVersion: 3.6.0
    53    operations:
    54      - name: countDocuments
    55        object: *collection0
    56        arguments:
    57          filter: {}
    58          comment: &stringComment "comment"
    59        expectResult: 3
    60    expectEvents:
    61      - client: *client0
    62        events:
    63          - commandStartedEvent:
    64              command:
    65                aggregate: *collection0Name
    66                pipeline: *pipeline
    67                comment: *stringComment
    68              commandName: aggregate
    69              databaseName: *database0Name
    70
    71  - description: "countDocuments with document comment on less than 4.4.0 - server error"
    72    runOnRequirements:
    73      - minServerVersion: 3.6.0
    74        maxServerVersion: 4.3.99
    75    operations:
    76      - name: countDocuments
    77        object: *collection0
    78        arguments:
    79          filter: {}
    80          comment: *documentComment
    81        expectError:
    82          isClientError: false
    83    expectEvents:
    84      - client: *client0
    85        events:
    86          - commandStartedEvent:
    87              command:
    88                aggregate: *collection0Name
    89                pipeline: *pipeline
    90                comment: *documentComment
    91              commandName: aggregate
    92              databaseName: *database0Name

View as plain text