...

Text file src/go.mongodb.org/mongo-driver/testdata/collection-management/clustered-indexes.yml

Documentation: go.mongodb.org/mongo-driver/testdata/collection-management

     1description: "clustered-indexes"
     2
     3schemaVersion: "1.4"
     4
     5runOnRequirements:
     6  - minServerVersion: "5.3"
     7    serverless: forbid
     8
     9createEntities:
    10  - client:
    11      id: &client0 client0
    12      observeEvents: [ commandStartedEvent ]
    13  - database:
    14      id: &database0 database0
    15      client: *client0
    16      databaseName: &database0Name ci-tests
    17  - collection:
    18      id: &collection0 collection0
    19      database: *database0
    20      collectionName: &collection0Name test
    21
    22initialData:
    23  - collectionName: *collection0Name
    24    databaseName: *database0Name
    25    documents: []
    26
    27tests:
    28  - description: "createCollection with clusteredIndex"
    29    operations:
    30      - name: dropCollection
    31        object: *database0
    32        arguments:
    33          collection: *collection0Name
    34      - name: createCollection
    35        object: *database0
    36        arguments:
    37          collection: *collection0Name
    38          clusteredIndex: &clusteredIndex
    39            key: { _id: 1 }
    40            unique: true
    41            name: &index0Name "test index"
    42      - name: assertCollectionExists
    43        object: testRunner
    44        arguments:
    45          databaseName: *database0Name
    46          collectionName: *collection0Name
    47    expectEvents:
    48      - client: *client0
    49        events:
    50          - commandStartedEvent:
    51              command:
    52                drop: *collection0Name
    53              databaseName: *database0Name
    54          - commandStartedEvent:
    55              command:
    56                create: *collection0Name
    57                clusteredIndex: *clusteredIndex
    58              databaseName: *database0Name
    59
    60  - description: "listCollections includes clusteredIndex"
    61    operations:
    62      - name: dropCollection
    63        object: *database0
    64        arguments:
    65          collection: *collection0Name
    66      - name: createCollection
    67        object: *database0
    68        arguments:
    69          collection: *collection0Name
    70          clusteredIndex: *clusteredIndex
    71      - name: listCollections
    72        object: *database0
    73        arguments:
    74          filter: &filter { name: { $eq: *collection0Name } }
    75        expectResult:
    76          - name: *collection0Name
    77            options:
    78              clusteredIndex:
    79                key: { _id: 1 }
    80                unique: true
    81                name: *index0Name
    82                v: { $$type: [ int, long ] }
    83    expectEvents:
    84      - client: *client0
    85        events:
    86          - commandStartedEvent:
    87              command:
    88                drop: *collection0Name
    89              databaseName: *database0Name
    90          - commandStartedEvent:
    91              command:
    92                create: *collection0Name
    93                clusteredIndex: *clusteredIndex
    94              databaseName: *database0Name
    95          - commandStartedEvent:
    96              command:
    97                listCollections: 1
    98                filter: *filter
    99              databaseName: *database0Name
   100
   101  - description: "listIndexes returns the index"
   102    operations:
   103      - name: dropCollection
   104        object: *database0
   105        arguments:
   106          collection: *collection0Name
   107      - name: createCollection
   108        object: *database0
   109        arguments:
   110          collection: *collection0Name
   111          clusteredIndex: *clusteredIndex
   112      - name: listIndexes
   113        object: *collection0
   114        expectResult:
   115          - key: { _id: 1 }
   116            name: *index0Name
   117            clustered: true
   118            unique: true
   119            v: { $$type: [ int, long ] }
   120    expectEvents:
   121      - client: *client0
   122        events:
   123          - commandStartedEvent:
   124              command:
   125                drop: *collection0Name
   126              databaseName: *database0Name
   127          - commandStartedEvent:
   128              command:
   129                create: *collection0Name
   130                clusteredIndex: *clusteredIndex
   131              databaseName: *database0Name
   132          - commandStartedEvent:
   133              command:
   134                listIndexes: *collection0Name
   135              databaseName: *database0Name

View as plain text