...

Text file src/go.mongodb.org/mongo-driver/testdata/change-streams/change-streams-disambiguatedPaths.yml

Documentation: go.mongodb.org/mongo-driver/testdata/change-streams

     1description: "disambiguatedPaths"
     2schemaVersion: "1.4"
     3createEntities:
     4  - client:
     5      id: &client0 client0
     6      useMultipleMongoses: false
     7  - database:
     8      id: &database0 database0
     9      client: *client0
    10      databaseName: *database0
    11  - collection:
    12      id: &collection0 collection0
    13      database: *database0
    14      collectionName: *collection0
    15
    16runOnRequirements:
    17  - minServerVersion: "6.1.0"
    18    topologies: [ replicaset, sharded-replicaset, load-balanced, sharded ]
    19    serverless: forbid
    20
    21initialData:
    22  - collectionName: *collection0
    23    databaseName: *database0
    24    documents: []
    25
    26tests:
    27  - description: "disambiguatedPaths is not present when showExpandedEvents is false/unset"
    28    operations:
    29      - name: insertOne
    30        object: *collection0
    31        arguments:
    32          document: { _id: 1, 'a': { '1': 1 } }
    33      - name: createChangeStream
    34        object: *collection0
    35        arguments: { pipeline: [] }
    36        saveResultAsEntity: &changeStream0 changeStream0
    37      - name: updateOne
    38        object: *collection0
    39        arguments:
    40          filter: { _id: 1 }
    41          update: { $set: { 'a.1': 2 } }
    42      - name: iterateUntilDocumentOrError
    43        object: *changeStream0
    44        expectResult:
    45          operationType: "update"
    46          ns: { db: *database0, coll: *collection0 }
    47          updateDescription:
    48            updatedFields: { $$exists: true }
    49            removedFields: { $$exists: true }
    50            truncatedArrays: { $$exists: true }
    51            disambiguatedPaths: { $$exists: false }
    52
    53  - description: "disambiguatedPaths is present on updateDescription when an ambiguous path is present"
    54    operations:
    55      - name: insertOne
    56        object: *collection0
    57        arguments:
    58          document: { _id: 1, 'a': { '1': 1 } }
    59      - name: createChangeStream
    60        object: *collection0
    61        arguments: { pipeline: [], showExpandedEvents: true }
    62        saveResultAsEntity: &changeStream0 changeStream0
    63      - name: updateOne
    64        object: *collection0
    65        arguments:
    66          filter: { _id: 1 }
    67          update: { $set: { 'a.1': 2 } }
    68      - name: iterateUntilDocumentOrError
    69        object: *changeStream0
    70        expectResult:
    71          operationType: "update"
    72          ns: { db: *database0, coll: *collection0 }
    73          updateDescription:
    74            updatedFields: { $$exists: true }
    75            removedFields: { $$exists: true }
    76            truncatedArrays: { $$exists: true }
    77            disambiguatedPaths: { 'a.1': ['a', '1'] }
    78
    79  - description: "disambiguatedPaths returns array indices as integers"
    80    operations:
    81      - name: insertOne
    82        object: *collection0
    83        arguments:
    84          document: { _id: 1, 'a': [{'1': 1 }] }
    85      - name: createChangeStream
    86        object: *collection0
    87        arguments: { pipeline: [], showExpandedEvents: true }
    88        saveResultAsEntity: &changeStream0 changeStream0
    89      - name: updateOne
    90        object: *collection0
    91        arguments:
    92          filter: { _id: 1 }
    93          update: { $set: { 'a.0.1': 2 } }
    94      - name: iterateUntilDocumentOrError
    95        object: *changeStream0
    96        expectResult:
    97          operationType: "update"
    98          ns: { db: *database0, coll: *collection0 }
    99          updateDescription:
   100            updatedFields: { $$exists: true }
   101            removedFields: { $$exists: true }
   102            truncatedArrays: { $$exists: true }
   103            disambiguatedPaths: { 'a.0.1': ['a', { $$type: 'int' },  '1'] }
   104

View as plain text