...

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

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

     1{
     2  "description": "bulkWrite-update-validation",
     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          "x": 11
    36        },
    37        {
    38          "_id": 2,
    39          "x": 22
    40        },
    41        {
    42          "_id": 3,
    43          "x": 33
    44        }
    45      ]
    46    }
    47  ],
    48  "tests": [
    49    {
    50      "description": "BulkWrite replaceOne prohibits atomic modifiers",
    51      "operations": [
    52        {
    53          "name": "bulkWrite",
    54          "object": "collection0",
    55          "arguments": {
    56            "requests": [
    57              {
    58                "replaceOne": {
    59                  "filter": {
    60                    "_id": 1
    61                  },
    62                  "replacement": {
    63                    "$set": {
    64                      "x": 22
    65                    }
    66                  }
    67                }
    68              }
    69            ]
    70          },
    71          "expectError": {
    72            "isClientError": true
    73          }
    74        }
    75      ],
    76      "expectEvents": [
    77        {
    78          "client": "client0",
    79          "events": []
    80        }
    81      ],
    82      "outcome": [
    83        {
    84          "collectionName": "coll0",
    85          "databaseName": "crud-tests",
    86          "documents": [
    87            {
    88              "_id": 1,
    89              "x": 11
    90            },
    91            {
    92              "_id": 2,
    93              "x": 22
    94            },
    95            {
    96              "_id": 3,
    97              "x": 33
    98            }
    99          ]
   100        }
   101      ]
   102    },
   103    {
   104      "description": "BulkWrite updateOne requires atomic modifiers",
   105      "operations": [
   106        {
   107          "name": "bulkWrite",
   108          "object": "collection0",
   109          "arguments": {
   110            "requests": [
   111              {
   112                "updateOne": {
   113                  "filter": {
   114                    "_id": 1
   115                  },
   116                  "update": {
   117                    "x": 22
   118                  }
   119                }
   120              }
   121            ]
   122          },
   123          "expectError": {
   124            "isClientError": true
   125          }
   126        }
   127      ],
   128      "expectEvents": [
   129        {
   130          "client": "client0",
   131          "events": []
   132        }
   133      ],
   134      "outcome": [
   135        {
   136          "collectionName": "coll0",
   137          "databaseName": "crud-tests",
   138          "documents": [
   139            {
   140              "_id": 1,
   141              "x": 11
   142            },
   143            {
   144              "_id": 2,
   145              "x": 22
   146            },
   147            {
   148              "_id": 3,
   149              "x": 33
   150            }
   151          ]
   152        }
   153      ]
   154    },
   155    {
   156      "description": "BulkWrite updateMany requires atomic modifiers",
   157      "operations": [
   158        {
   159          "name": "bulkWrite",
   160          "object": "collection0",
   161          "arguments": {
   162            "requests": [
   163              {
   164                "updateMany": {
   165                  "filter": {
   166                    "_id": {
   167                      "$gt": 1
   168                    }
   169                  },
   170                  "update": {
   171                    "x": 44
   172                  }
   173                }
   174              }
   175            ]
   176          },
   177          "expectError": {
   178            "isClientError": true
   179          }
   180        }
   181      ],
   182      "expectEvents": [
   183        {
   184          "client": "client0",
   185          "events": []
   186        }
   187      ],
   188      "outcome": [
   189        {
   190          "collectionName": "coll0",
   191          "databaseName": "crud-tests",
   192          "documents": [
   193            {
   194              "_id": 1,
   195              "x": 11
   196            },
   197            {
   198              "_id": 2,
   199              "x": 22
   200            },
   201            {
   202              "_id": 3,
   203              "x": 33
   204            }
   205          ]
   206        }
   207      ]
   208    }
   209  ]
   210}

View as plain text