...

Text file src/go.mongodb.org/mongo-driver/testdata/crud/v1/write/findOneAndReplace-upsert.json

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

     1{
     2  "data": [
     3    {
     4      "_id": 1,
     5      "x": 11
     6    },
     7    {
     8      "_id": 2,
     9      "x": 22
    10    },
    11    {
    12      "_id": 3,
    13      "x": 33
    14    }
    15  ],
    16  "minServerVersion": "2.6",
    17  "tests": [
    18    {
    19      "description": "FindOneAndReplace when no documents match without id specified with upsert returning the document before modification",
    20      "operation": {
    21        "name": "findOneAndReplace",
    22        "arguments": {
    23          "filter": {
    24            "_id": 4
    25          },
    26          "replacement": {
    27            "x": 44
    28          },
    29          "projection": {
    30            "x": 1,
    31            "_id": 0
    32          },
    33          "upsert": true
    34        }
    35      },
    36      "outcome": {
    37        "result": null,
    38        "collection": {
    39          "data": [
    40            {
    41              "_id": 1,
    42              "x": 11
    43            },
    44            {
    45              "_id": 2,
    46              "x": 22
    47            },
    48            {
    49              "_id": 3,
    50              "x": 33
    51            },
    52            {
    53              "_id": 4,
    54              "x": 44
    55            }
    56          ]
    57        }
    58      }
    59    },
    60    {
    61      "description": "FindOneAndReplace when no documents match without id specified with upsert returning the document after modification",
    62      "operation": {
    63        "name": "findOneAndReplace",
    64        "arguments": {
    65          "filter": {
    66            "_id": 4
    67          },
    68          "replacement": {
    69            "x": 44
    70          },
    71          "projection": {
    72            "x": 1,
    73            "_id": 0
    74          },
    75          "returnDocument": "After",
    76          "sort": {
    77            "x": 1
    78          },
    79          "upsert": true
    80        }
    81      },
    82      "outcome": {
    83        "result": {
    84          "x": 44
    85        },
    86        "collection": {
    87          "data": [
    88            {
    89              "_id": 1,
    90              "x": 11
    91            },
    92            {
    93              "_id": 2,
    94              "x": 22
    95            },
    96            {
    97              "_id": 3,
    98              "x": 33
    99            },
   100            {
   101              "_id": 4,
   102              "x": 44
   103            }
   104          ]
   105        }
   106      }
   107    },
   108    {
   109      "description": "FindOneAndReplace when no documents match with id specified with upsert returning the document before modification",
   110      "operation": {
   111        "name": "findOneAndReplace",
   112        "arguments": {
   113          "filter": {
   114            "_id": 4
   115          },
   116          "replacement": {
   117            "_id": 4,
   118            "x": 44
   119          },
   120          "projection": {
   121            "x": 1,
   122            "_id": 0
   123          },
   124          "upsert": true
   125        }
   126      },
   127      "outcome": {
   128        "result": null,
   129        "collection": {
   130          "data": [
   131            {
   132              "_id": 1,
   133              "x": 11
   134            },
   135            {
   136              "_id": 2,
   137              "x": 22
   138            },
   139            {
   140              "_id": 3,
   141              "x": 33
   142            },
   143            {
   144              "_id": 4,
   145              "x": 44
   146            }
   147          ]
   148        }
   149      }
   150    },
   151    {
   152      "description": "FindOneAndReplace when no documents match with id specified with upsert returning the document after modification",
   153      "operation": {
   154        "name": "findOneAndReplace",
   155        "arguments": {
   156          "filter": {
   157            "_id": 4
   158          },
   159          "replacement": {
   160            "_id": 4,
   161            "x": 44
   162          },
   163          "projection": {
   164            "x": 1,
   165            "_id": 0
   166          },
   167          "returnDocument": "After",
   168          "sort": {
   169            "x": 1
   170          },
   171          "upsert": true
   172        }
   173      },
   174      "outcome": {
   175        "result": {
   176          "x": 44
   177        },
   178        "collection": {
   179          "data": [
   180            {
   181              "_id": 1,
   182              "x": 11
   183            },
   184            {
   185              "_id": 2,
   186              "x": 22
   187            },
   188            {
   189              "_id": 3,
   190              "x": 33
   191            },
   192            {
   193              "_id": 4,
   194              "x": 44
   195            }
   196          ]
   197        }
   198      }
   199    }
   200  ]
   201}

View as plain text