...

Text file src/go.mongodb.org/mongo-driver/testdata/crud/unified/bulkWrite-comment.json

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

     1{
     2  "description": "bulkWrite-comment",
     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-v2"
    18      }
    19    },
    20    {
    21      "collection": {
    22        "id": "collection0",
    23        "database": "database0",
    24        "collectionName": "BulkWrite_comment"
    25      }
    26    }
    27  ],
    28  "initialData": [
    29    {
    30      "collectionName": "BulkWrite_comment",
    31      "databaseName": "crud-v2",
    32      "documents": [
    33        {
    34          "_id": 1,
    35          "x": 11
    36        },
    37        {
    38          "_id": 2,
    39          "x": 22
    40        },
    41        {
    42          "_id": 3,
    43          "x": 33
    44        },
    45        {
    46          "_id": 4,
    47          "x": 44
    48        }
    49      ]
    50    }
    51  ],
    52  "tests": [
    53    {
    54      "description": "BulkWrite with string comment",
    55      "runOnRequirements": [
    56        {
    57          "minServerVersion": "4.4"
    58        }
    59      ],
    60      "operations": [
    61        {
    62          "object": "collection0",
    63          "name": "bulkWrite",
    64          "arguments": {
    65            "requests": [
    66              {
    67                "insertOne": {
    68                  "document": {
    69                    "_id": 5,
    70                    "x": "inserted"
    71                  }
    72                }
    73              },
    74              {
    75                "replaceOne": {
    76                  "filter": {
    77                    "_id": 1
    78                  },
    79                  "replacement": {
    80                    "_id": 1,
    81                    "x": "replaced"
    82                  }
    83                }
    84              },
    85              {
    86                "updateOne": {
    87                  "filter": {
    88                    "_id": 2
    89                  },
    90                  "update": {
    91                    "$set": {
    92                      "x": "updated"
    93                    }
    94                  }
    95                }
    96              },
    97              {
    98                "deleteOne": {
    99                  "filter": {
   100                    "_id": 3
   101                  }
   102                }
   103              }
   104            ],
   105            "comment": "comment"
   106          },
   107          "expectResult": {
   108            "deletedCount": 1,
   109            "insertedCount": 1,
   110            "insertedIds": {
   111              "$$unsetOrMatches": {
   112                "0": 5
   113              }
   114            },
   115            "matchedCount": 2,
   116            "modifiedCount": 2,
   117            "upsertedCount": 0,
   118            "upsertedIds": {}
   119          }
   120        }
   121      ],
   122      "expectEvents": [
   123        {
   124          "client": "client0",
   125          "events": [
   126            {
   127              "commandStartedEvent": {
   128                "command": {
   129                  "insert": "BulkWrite_comment",
   130                  "documents": [
   131                    {
   132                      "_id": 5,
   133                      "x": "inserted"
   134                    }
   135                  ],
   136                  "ordered": true,
   137                  "comment": "comment"
   138                }
   139              }
   140            },
   141            {
   142              "commandStartedEvent": {
   143                "command": {
   144                  "update": "BulkWrite_comment",
   145                  "updates": [
   146                    {
   147                      "q": {
   148                        "_id": 1
   149                      },
   150                      "u": {
   151                        "_id": 1,
   152                        "x": "replaced"
   153                      },
   154                      "multi": {
   155                        "$$unsetOrMatches": false
   156                      },
   157                      "upsert": {
   158                        "$$unsetOrMatches": false
   159                      }
   160                    },
   161                    {
   162                      "q": {
   163                        "_id": 2
   164                      },
   165                      "u": {
   166                        "$set": {
   167                          "x": "updated"
   168                        }
   169                      },
   170                      "multi": {
   171                        "$$unsetOrMatches": false
   172                      },
   173                      "upsert": {
   174                        "$$unsetOrMatches": false
   175                      }
   176                    }
   177                  ],
   178                  "ordered": true,
   179                  "comment": "comment"
   180                }
   181              }
   182            },
   183            {
   184              "commandStartedEvent": {
   185                "command": {
   186                  "delete": "BulkWrite_comment",
   187                  "deletes": [
   188                    {
   189                      "q": {
   190                        "_id": 3
   191                      },
   192                      "limit": 1
   193                    }
   194                  ],
   195                  "ordered": true,
   196                  "comment": "comment"
   197                }
   198              }
   199            }
   200          ]
   201        }
   202      ],
   203      "outcome": [
   204        {
   205          "collectionName": "BulkWrite_comment",
   206          "databaseName": "crud-v2",
   207          "documents": [
   208            {
   209              "_id": 1,
   210              "x": "replaced"
   211            },
   212            {
   213              "_id": 2,
   214              "x": "updated"
   215            },
   216            {
   217              "_id": 4,
   218              "x": 44
   219            },
   220            {
   221              "_id": 5,
   222              "x": "inserted"
   223            }
   224          ]
   225        }
   226      ]
   227    },
   228    {
   229      "description": "BulkWrite with document comment",
   230      "runOnRequirements": [
   231        {
   232          "minServerVersion": "4.4"
   233        }
   234      ],
   235      "operations": [
   236        {
   237          "object": "collection0",
   238          "name": "bulkWrite",
   239          "arguments": {
   240            "requests": [
   241              {
   242                "insertOne": {
   243                  "document": {
   244                    "_id": 5,
   245                    "x": "inserted"
   246                  }
   247                }
   248              },
   249              {
   250                "replaceOne": {
   251                  "filter": {
   252                    "_id": 1
   253                  },
   254                  "replacement": {
   255                    "_id": 1,
   256                    "x": "replaced"
   257                  }
   258                }
   259              },
   260              {
   261                "updateOne": {
   262                  "filter": {
   263                    "_id": 2
   264                  },
   265                  "update": {
   266                    "$set": {
   267                      "x": "updated"
   268                    }
   269                  }
   270                }
   271              },
   272              {
   273                "deleteOne": {
   274                  "filter": {
   275                    "_id": 3
   276                  }
   277                }
   278              }
   279            ],
   280            "comment": {
   281              "key": "value"
   282            }
   283          },
   284          "expectResult": {
   285            "deletedCount": 1,
   286            "insertedCount": 1,
   287            "insertedIds": {
   288              "$$unsetOrMatches": {
   289                "0": 5
   290              }
   291            },
   292            "matchedCount": 2,
   293            "modifiedCount": 2,
   294            "upsertedCount": 0,
   295            "upsertedIds": {}
   296          }
   297        }
   298      ],
   299      "expectEvents": [
   300        {
   301          "client": "client0",
   302          "events": [
   303            {
   304              "commandStartedEvent": {
   305                "command": {
   306                  "insert": "BulkWrite_comment",
   307                  "documents": [
   308                    {
   309                      "_id": 5,
   310                      "x": "inserted"
   311                    }
   312                  ],
   313                  "ordered": true,
   314                  "comment": {
   315                    "key": "value"
   316                  }
   317                }
   318              }
   319            },
   320            {
   321              "commandStartedEvent": {
   322                "command": {
   323                  "update": "BulkWrite_comment",
   324                  "updates": [
   325                    {
   326                      "q": {
   327                        "_id": 1
   328                      },
   329                      "u": {
   330                        "_id": 1,
   331                        "x": "replaced"
   332                      },
   333                      "multi": {
   334                        "$$unsetOrMatches": false
   335                      },
   336                      "upsert": {
   337                        "$$unsetOrMatches": false
   338                      }
   339                    },
   340                    {
   341                      "q": {
   342                        "_id": 2
   343                      },
   344                      "u": {
   345                        "$set": {
   346                          "x": "updated"
   347                        }
   348                      },
   349                      "multi": {
   350                        "$$unsetOrMatches": false
   351                      },
   352                      "upsert": {
   353                        "$$unsetOrMatches": false
   354                      }
   355                    }
   356                  ],
   357                  "ordered": true,
   358                  "comment": {
   359                    "key": "value"
   360                  }
   361                }
   362              }
   363            },
   364            {
   365              "commandStartedEvent": {
   366                "command": {
   367                  "delete": "BulkWrite_comment",
   368                  "deletes": [
   369                    {
   370                      "q": {
   371                        "_id": 3
   372                      },
   373                      "limit": 1
   374                    }
   375                  ],
   376                  "ordered": true,
   377                  "comment": {
   378                    "key": "value"
   379                  }
   380                }
   381              }
   382            }
   383          ]
   384        }
   385      ],
   386      "outcome": [
   387        {
   388          "collectionName": "BulkWrite_comment",
   389          "databaseName": "crud-v2",
   390          "documents": [
   391            {
   392              "_id": 1,
   393              "x": "replaced"
   394            },
   395            {
   396              "_id": 2,
   397              "x": "updated"
   398            },
   399            {
   400              "_id": 4,
   401              "x": 44
   402            },
   403            {
   404              "_id": 5,
   405              "x": "inserted"
   406            }
   407          ]
   408        }
   409      ]
   410    },
   411    {
   412      "description": "BulkWrite with comment - pre 4.4",
   413      "runOnRequirements": [
   414        {
   415          "minServerVersion": "3.4.0",
   416          "maxServerVersion": "4.2.99"
   417        }
   418      ],
   419      "operations": [
   420        {
   421          "object": "collection0",
   422          "name": "bulkWrite",
   423          "arguments": {
   424            "requests": [
   425              {
   426                "insertOne": {
   427                  "document": {
   428                    "_id": 5,
   429                    "x": "inserted"
   430                  }
   431                }
   432              },
   433              {
   434                "replaceOne": {
   435                  "filter": {
   436                    "_id": 1
   437                  },
   438                  "replacement": {
   439                    "_id": 1,
   440                    "x": "replaced"
   441                  }
   442                }
   443              },
   444              {
   445                "updateOne": {
   446                  "filter": {
   447                    "_id": 2
   448                  },
   449                  "update": {
   450                    "$set": {
   451                      "x": "updated"
   452                    }
   453                  }
   454                }
   455              },
   456              {
   457                "deleteOne": {
   458                  "filter": {
   459                    "_id": 3
   460                  }
   461                }
   462              }
   463            ],
   464            "comment": "comment"
   465          },
   466          "expectError": {
   467            "isClientError": false
   468          }
   469        }
   470      ],
   471      "expectEvents": [
   472        {
   473          "client": "client0",
   474          "events": [
   475            {
   476              "commandStartedEvent": {
   477                "command": {
   478                  "insert": "BulkWrite_comment",
   479                  "documents": [
   480                    {
   481                      "_id": 5,
   482                      "x": "inserted"
   483                    }
   484                  ],
   485                  "ordered": true,
   486                  "comment": "comment"
   487                }
   488              }
   489            }
   490          ]
   491        }
   492      ],
   493      "outcome": [
   494        {
   495          "collectionName": "BulkWrite_comment",
   496          "databaseName": "crud-v2",
   497          "documents": [
   498            {
   499              "_id": 1,
   500              "x": 11
   501            },
   502            {
   503              "_id": 2,
   504              "x": 22
   505            },
   506            {
   507              "_id": 3,
   508              "x": 33
   509            },
   510            {
   511              "_id": 4,
   512              "x": 44
   513            }
   514          ]
   515        }
   516      ]
   517    }
   518  ]
   519}

View as plain text