...

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

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

     1{
     2  "description": "disambiguatedPaths",
     3  "schemaVersion": "1.4",
     4  "createEntities": [
     5    {
     6      "client": {
     7        "id": "client0",
     8        "useMultipleMongoses": false
     9      }
    10    },
    11    {
    12      "database": {
    13        "id": "database0",
    14        "client": "client0",
    15        "databaseName": "database0"
    16      }
    17    },
    18    {
    19      "collection": {
    20        "id": "collection0",
    21        "database": "database0",
    22        "collectionName": "collection0"
    23      }
    24    }
    25  ],
    26  "runOnRequirements": [
    27    {
    28      "minServerVersion": "6.1.0",
    29      "topologies": [
    30        "replicaset",
    31        "sharded-replicaset",
    32        "load-balanced",
    33        "sharded"
    34      ],
    35      "serverless": "forbid"
    36    }
    37  ],
    38  "initialData": [
    39    {
    40      "collectionName": "collection0",
    41      "databaseName": "database0",
    42      "documents": []
    43    }
    44  ],
    45  "tests": [
    46    {
    47      "description": "disambiguatedPaths is not present when showExpandedEvents is false/unset",
    48      "operations": [
    49        {
    50          "name": "insertOne",
    51          "object": "collection0",
    52          "arguments": {
    53            "document": {
    54              "_id": 1,
    55              "a": {
    56                "1": 1
    57              }
    58            }
    59          }
    60        },
    61        {
    62          "name": "createChangeStream",
    63          "object": "collection0",
    64          "arguments": {
    65            "pipeline": []
    66          },
    67          "saveResultAsEntity": "changeStream0"
    68        },
    69        {
    70          "name": "updateOne",
    71          "object": "collection0",
    72          "arguments": {
    73            "filter": {
    74              "_id": 1
    75            },
    76            "update": {
    77              "$set": {
    78                "a.1": 2
    79              }
    80            }
    81          }
    82        },
    83        {
    84          "name": "iterateUntilDocumentOrError",
    85          "object": "changeStream0",
    86          "expectResult": {
    87            "operationType": "update",
    88            "ns": {
    89              "db": "database0",
    90              "coll": "collection0"
    91            },
    92            "updateDescription": {
    93              "updatedFields": {
    94                "$$exists": true
    95              },
    96              "removedFields": {
    97                "$$exists": true
    98              },
    99              "truncatedArrays": {
   100                "$$exists": true
   101              },
   102              "disambiguatedPaths": {
   103                "$$exists": false
   104              }
   105            }
   106          }
   107        }
   108      ]
   109    },
   110    {
   111      "description": "disambiguatedPaths is present on updateDescription when an ambiguous path is present",
   112      "operations": [
   113        {
   114          "name": "insertOne",
   115          "object": "collection0",
   116          "arguments": {
   117            "document": {
   118              "_id": 1,
   119              "a": {
   120                "1": 1
   121              }
   122            }
   123          }
   124        },
   125        {
   126          "name": "createChangeStream",
   127          "object": "collection0",
   128          "arguments": {
   129            "pipeline": [],
   130            "showExpandedEvents": true
   131          },
   132          "saveResultAsEntity": "changeStream0"
   133        },
   134        {
   135          "name": "updateOne",
   136          "object": "collection0",
   137          "arguments": {
   138            "filter": {
   139              "_id": 1
   140            },
   141            "update": {
   142              "$set": {
   143                "a.1": 2
   144              }
   145            }
   146          }
   147        },
   148        {
   149          "name": "iterateUntilDocumentOrError",
   150          "object": "changeStream0",
   151          "expectResult": {
   152            "operationType": "update",
   153            "ns": {
   154              "db": "database0",
   155              "coll": "collection0"
   156            },
   157            "updateDescription": {
   158              "updatedFields": {
   159                "$$exists": true
   160              },
   161              "removedFields": {
   162                "$$exists": true
   163              },
   164              "truncatedArrays": {
   165                "$$exists": true
   166              },
   167              "disambiguatedPaths": {
   168                "a.1": [
   169                  "a",
   170                  "1"
   171                ]
   172              }
   173            }
   174          }
   175        }
   176      ]
   177    },
   178    {
   179      "description": "disambiguatedPaths returns array indices as integers",
   180      "operations": [
   181        {
   182          "name": "insertOne",
   183          "object": "collection0",
   184          "arguments": {
   185            "document": {
   186              "_id": 1,
   187              "a": [
   188                {
   189                  "1": 1
   190                }
   191              ]
   192            }
   193          }
   194        },
   195        {
   196          "name": "createChangeStream",
   197          "object": "collection0",
   198          "arguments": {
   199            "pipeline": [],
   200            "showExpandedEvents": true
   201          },
   202          "saveResultAsEntity": "changeStream0"
   203        },
   204        {
   205          "name": "updateOne",
   206          "object": "collection0",
   207          "arguments": {
   208            "filter": {
   209              "_id": 1
   210            },
   211            "update": {
   212              "$set": {
   213                "a.0.1": 2
   214              }
   215            }
   216          }
   217        },
   218        {
   219          "name": "iterateUntilDocumentOrError",
   220          "object": "changeStream0",
   221          "expectResult": {
   222            "operationType": "update",
   223            "ns": {
   224              "db": "database0",
   225              "coll": "collection0"
   226            },
   227            "updateDescription": {
   228              "updatedFields": {
   229                "$$exists": true
   230              },
   231              "removedFields": {
   232                "$$exists": true
   233              },
   234              "truncatedArrays": {
   235                "$$exists": true
   236              },
   237              "disambiguatedPaths": {
   238                "a.0.1": [
   239                  "a",
   240                  {
   241                    "$$type": "int"
   242                  },
   243                  "1"
   244                ]
   245              }
   246            }
   247          }
   248        }
   249      ]
   250    }
   251  ]
   252}
   253

View as plain text