...

Text file src/go.mongodb.org/mongo-driver/testdata/crud/unified/updateMany-dots_and_dollars.json

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

     1{
     2  "description": "updateMany-dots_and_dollars",
     3  "schemaVersion": "1.0",
     4  "createEntities": [
     5    {
     6      "client": {
     7        "id": "client0",
     8        "observeEvents": [
     9          "commandStartedEvent"
    10        ]
    11      }
    12    },
    13    {
    14      "database": {
    15        "id": "database0",
    16        "client": "client0",
    17        "databaseName": "crud-tests"
    18      }
    19    },
    20    {
    21      "collection": {
    22        "id": "collection0",
    23        "database": "database0",
    24        "collectionName": "coll0"
    25      }
    26    }
    27  ],
    28  "initialData": [
    29    {
    30      "collectionName": "coll0",
    31      "databaseName": "crud-tests",
    32      "documents": [
    33        {
    34          "_id": 1,
    35          "foo": {}
    36        }
    37      ]
    38    }
    39  ],
    40  "tests": [
    41    {
    42      "description": "Updating document to set top-level dollar-prefixed key on 5.0+ server",
    43      "runOnRequirements": [
    44        {
    45          "minServerVersion": "5.0"
    46        }
    47      ],
    48      "operations": [
    49        {
    50          "name": "updateMany",
    51          "object": "collection0",
    52          "arguments": {
    53            "filter": {
    54              "_id": 1
    55            },
    56            "update": [
    57              {
    58                "$replaceWith": {
    59                  "$setField": {
    60                    "field": {
    61                      "$literal": "$a"
    62                    },
    63                    "value": 1,
    64                    "input": "$$ROOT"
    65                  }
    66                }
    67              }
    68            ]
    69          },
    70          "expectResult": {
    71            "matchedCount": 1,
    72            "modifiedCount": 1,
    73            "upsertedCount": 0
    74          }
    75        }
    76      ],
    77      "expectEvents": [
    78        {
    79          "client": "client0",
    80          "events": [
    81            {
    82              "commandStartedEvent": {
    83                "command": {
    84                  "update": "coll0",
    85                  "updates": [
    86                    {
    87                      "q": {
    88                        "_id": 1
    89                      },
    90                      "u": [
    91                        {
    92                          "$replaceWith": {
    93                            "$setField": {
    94                              "field": {
    95                                "$literal": "$a"
    96                              },
    97                              "value": 1,
    98                              "input": "$$ROOT"
    99                            }
   100                          }
   101                        }
   102                      ],
   103                      "multi": true,
   104                      "upsert": {
   105                        "$$unsetOrMatches": false
   106                      }
   107                    }
   108                  ]
   109                }
   110              }
   111            }
   112          ]
   113        }
   114      ],
   115      "outcome": [
   116        {
   117          "collectionName": "coll0",
   118          "databaseName": "crud-tests",
   119          "documents": [
   120            {
   121              "_id": 1,
   122              "foo": {},
   123              "$a": 1
   124            }
   125          ]
   126        }
   127      ]
   128    },
   129    {
   130      "description": "Updating document to set top-level dotted key on 5.0+ server",
   131      "runOnRequirements": [
   132        {
   133          "minServerVersion": "5.0"
   134        }
   135      ],
   136      "operations": [
   137        {
   138          "name": "updateMany",
   139          "object": "collection0",
   140          "arguments": {
   141            "filter": {
   142              "_id": 1
   143            },
   144            "update": [
   145              {
   146                "$replaceWith": {
   147                  "$setField": {
   148                    "field": {
   149                      "$literal": "a.b"
   150                    },
   151                    "value": 1,
   152                    "input": "$$ROOT"
   153                  }
   154                }
   155              }
   156            ]
   157          },
   158          "expectResult": {
   159            "matchedCount": 1,
   160            "modifiedCount": 1,
   161            "upsertedCount": 0
   162          }
   163        }
   164      ],
   165      "expectEvents": [
   166        {
   167          "client": "client0",
   168          "events": [
   169            {
   170              "commandStartedEvent": {
   171                "command": {
   172                  "update": "coll0",
   173                  "updates": [
   174                    {
   175                      "q": {
   176                        "_id": 1
   177                      },
   178                      "u": [
   179                        {
   180                          "$replaceWith": {
   181                            "$setField": {
   182                              "field": {
   183                                "$literal": "a.b"
   184                              },
   185                              "value": 1,
   186                              "input": "$$ROOT"
   187                            }
   188                          }
   189                        }
   190                      ],
   191                      "multi": true,
   192                      "upsert": {
   193                        "$$unsetOrMatches": false
   194                      }
   195                    }
   196                  ]
   197                }
   198              }
   199            }
   200          ]
   201        }
   202      ],
   203      "outcome": [
   204        {
   205          "collectionName": "coll0",
   206          "databaseName": "crud-tests",
   207          "documents": [
   208            {
   209              "_id": 1,
   210              "foo": {},
   211              "a.b": 1
   212            }
   213          ]
   214        }
   215      ]
   216    },
   217    {
   218      "description": "Updating document to set dollar-prefixed key in embedded doc on 5.0+ server",
   219      "runOnRequirements": [
   220        {
   221          "minServerVersion": "5.0"
   222        }
   223      ],
   224      "operations": [
   225        {
   226          "name": "updateMany",
   227          "object": "collection0",
   228          "arguments": {
   229            "filter": {
   230              "_id": 1
   231            },
   232            "update": [
   233              {
   234                "$set": {
   235                  "foo": {
   236                    "$setField": {
   237                      "field": {
   238                        "$literal": "$a"
   239                      },
   240                      "value": 1,
   241                      "input": "$foo"
   242                    }
   243                  }
   244                }
   245              }
   246            ]
   247          },
   248          "expectResult": {
   249            "matchedCount": 1,
   250            "modifiedCount": 1,
   251            "upsertedCount": 0
   252          }
   253        }
   254      ],
   255      "expectEvents": [
   256        {
   257          "client": "client0",
   258          "events": [
   259            {
   260              "commandStartedEvent": {
   261                "command": {
   262                  "update": "coll0",
   263                  "updates": [
   264                    {
   265                      "q": {
   266                        "_id": 1
   267                      },
   268                      "u": [
   269                        {
   270                          "$set": {
   271                            "foo": {
   272                              "$setField": {
   273                                "field": {
   274                                  "$literal": "$a"
   275                                },
   276                                "value": 1,
   277                                "input": "$foo"
   278                              }
   279                            }
   280                          }
   281                        }
   282                      ],
   283                      "multi": true,
   284                      "upsert": {
   285                        "$$unsetOrMatches": false
   286                      }
   287                    }
   288                  ]
   289                }
   290              }
   291            }
   292          ]
   293        }
   294      ],
   295      "outcome": [
   296        {
   297          "collectionName": "coll0",
   298          "databaseName": "crud-tests",
   299          "documents": [
   300            {
   301              "_id": 1,
   302              "foo": {
   303                "$a": 1
   304              }
   305            }
   306          ]
   307        }
   308      ]
   309    },
   310    {
   311      "description": "Updating document to set dotted key in embedded doc on 5.0+ server",
   312      "runOnRequirements": [
   313        {
   314          "minServerVersion": "5.0"
   315        }
   316      ],
   317      "operations": [
   318        {
   319          "name": "updateMany",
   320          "object": "collection0",
   321          "arguments": {
   322            "filter": {
   323              "_id": 1
   324            },
   325            "update": [
   326              {
   327                "$set": {
   328                  "foo": {
   329                    "$setField": {
   330                      "field": {
   331                        "$literal": "a.b"
   332                      },
   333                      "value": 1,
   334                      "input": "$foo"
   335                    }
   336                  }
   337                }
   338              }
   339            ]
   340          },
   341          "expectResult": {
   342            "matchedCount": 1,
   343            "modifiedCount": 1,
   344            "upsertedCount": 0
   345          }
   346        }
   347      ],
   348      "expectEvents": [
   349        {
   350          "client": "client0",
   351          "events": [
   352            {
   353              "commandStartedEvent": {
   354                "command": {
   355                  "update": "coll0",
   356                  "updates": [
   357                    {
   358                      "q": {
   359                        "_id": 1
   360                      },
   361                      "u": [
   362                        {
   363                          "$set": {
   364                            "foo": {
   365                              "$setField": {
   366                                "field": {
   367                                  "$literal": "a.b"
   368                                },
   369                                "value": 1,
   370                                "input": "$foo"
   371                              }
   372                            }
   373                          }
   374                        }
   375                      ],
   376                      "multi": true,
   377                      "upsert": {
   378                        "$$unsetOrMatches": false
   379                      }
   380                    }
   381                  ]
   382                }
   383              }
   384            }
   385          ]
   386        }
   387      ],
   388      "outcome": [
   389        {
   390          "collectionName": "coll0",
   391          "databaseName": "crud-tests",
   392          "documents": [
   393            {
   394              "_id": 1,
   395              "foo": {
   396                "a.b": 1
   397              }
   398            }
   399          ]
   400        }
   401      ]
   402    }
   403  ]
   404}

View as plain text