...

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

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

     1{
     2  "description": "BulkWrite replaceOne-let",
     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        },
    36        {
    37          "_id": 2
    38        }
    39      ]
    40    }
    41  ],
    42  "tests": [
    43    {
    44      "description": "BulkWrite replaceOne with let option",
    45      "runOnRequirements": [
    46        {
    47          "minServerVersion": "5.0"
    48        }
    49      ],
    50      "operations": [
    51        {
    52          "object": "collection0",
    53          "name": "bulkWrite",
    54          "arguments": {
    55            "requests": [
    56              {
    57                "replaceOne": {
    58                  "filter": {
    59                    "$expr": {
    60                      "$eq": [
    61                        "$_id",
    62                        "$$id"
    63                      ]
    64                    }
    65                  },
    66                  "replacement": {
    67                    "x": 3
    68                  }
    69                }
    70              }
    71            ],
    72            "let": {
    73              "id": 1
    74            }
    75          }
    76        }
    77      ],
    78      "expectEvents": [
    79        {
    80          "client": "client0",
    81          "events": [
    82            {
    83              "commandStartedEvent": {
    84                "command": {
    85                  "update": "coll0",
    86                  "updates": [
    87                    {
    88                      "q": {
    89                        "$expr": {
    90                          "$eq": [
    91                            "$_id",
    92                            "$$id"
    93                          ]
    94                        }
    95                      },
    96                      "u": {
    97                        "x": 3
    98                      },
    99                      "multi": {
   100                        "$$unsetOrMatches": false
   101                      },
   102                      "upsert": {
   103                        "$$unsetOrMatches": false
   104                      }
   105                    }
   106                  ],
   107                  "let": {
   108                    "id": 1
   109                  }
   110                }
   111              }
   112            }
   113          ]
   114        }
   115      ],
   116      "outcome": [
   117        {
   118          "collectionName": "coll0",
   119          "databaseName": "crud-tests",
   120          "documents": [
   121            {
   122              "_id": 1,
   123              "x": 3
   124            },
   125            {
   126              "_id": 2
   127            }
   128          ]
   129        }
   130      ]
   131    },
   132    {
   133      "description": "BulkWrite replaceOne with let option unsupported (server-side error)",
   134      "runOnRequirements": [
   135        {
   136          "minServerVersion": "4.2",
   137          "maxServerVersion": "4.9"
   138        }
   139      ],
   140      "operations": [
   141        {
   142          "object": "collection0",
   143          "name": "bulkWrite",
   144          "arguments": {
   145            "requests": [
   146              {
   147                "replaceOne": {
   148                  "filter": {
   149                    "$expr": {
   150                      "$eq": [
   151                        "$_id",
   152                        "$$id"
   153                      ]
   154                    }
   155                  },
   156                  "replacement": {
   157                    "x": 3
   158                  }
   159                }
   160              }
   161            ],
   162            "let": {
   163              "id": 1
   164            }
   165          },
   166          "expectError": {
   167            "errorContains": "'update.let' is an unknown field",
   168            "isClientError": false
   169          }
   170        }
   171      ],
   172      "expectEvents": [
   173        {
   174          "client": "client0",
   175          "events": [
   176            {
   177              "commandStartedEvent": {
   178                "command": {
   179                  "update": "coll0",
   180                  "updates": [
   181                    {
   182                      "q": {
   183                        "$expr": {
   184                          "$eq": [
   185                            "$_id",
   186                            "$$id"
   187                          ]
   188                        }
   189                      },
   190                      "u": {
   191                        "x": 3
   192                      },
   193                      "multi": {
   194                        "$$unsetOrMatches": false
   195                      },
   196                      "upsert": {
   197                        "$$unsetOrMatches": false
   198                      }
   199                    }
   200                  ],
   201                  "let": {
   202                    "id": 1
   203                  }
   204                }
   205              }
   206            }
   207          ]
   208        }
   209      ],
   210      "outcome": [
   211        {
   212          "collectionName": "coll0",
   213          "databaseName": "crud-tests",
   214          "documents": [
   215            {
   216              "_id": 1
   217            },
   218            {
   219              "_id": 2
   220            }
   221          ]
   222        }
   223      ]
   224    }
   225  ]
   226}

View as plain text