...

Text file src/go.mongodb.org/mongo-driver/testdata/read-write-concern/operation/default-write-concern-3.4.json

Documentation: go.mongodb.org/mongo-driver/testdata/read-write-concern/operation

     1{
     2  "data": [
     3    {
     4      "_id": 1,
     5      "x": 11
     6    },
     7    {
     8      "_id": 2,
     9      "x": 22
    10    }
    11  ],
    12  "collection_name": "default_write_concern_coll",
    13  "database_name": "default_write_concern_db",
    14  "runOn": [
    15    {
    16      "minServerVersion": "3.4"
    17    }
    18  ],
    19  "tests": [
    20    {
    21      "description": "Aggregate with $out omits default write concern",
    22      "operations": [
    23        {
    24          "object": "collection",
    25          "collectionOptions": {
    26            "writeConcern": {}
    27          },
    28          "name": "aggregate",
    29          "arguments": {
    30            "pipeline": [
    31              {
    32                "$match": {
    33                  "_id": {
    34                    "$gt": 1
    35                  }
    36                }
    37              },
    38              {
    39                "$out": "other_collection_name"
    40              }
    41            ]
    42          }
    43        }
    44      ],
    45      "outcome": {
    46        "collection": {
    47          "name": "other_collection_name",
    48          "data": [
    49            {
    50              "_id": 2,
    51              "x": 22
    52            }
    53          ]
    54        }
    55      },
    56      "expectations": [
    57        {
    58          "command_started_event": {
    59            "command": {
    60              "aggregate": "default_write_concern_coll",
    61              "pipeline": [
    62                {
    63                  "$match": {
    64                    "_id": {
    65                      "$gt": 1
    66                    }
    67                  }
    68                },
    69                {
    70                  "$out": "other_collection_name"
    71                }
    72              ],
    73              "writeConcern": null
    74            }
    75          }
    76        }
    77      ]
    78    },
    79    {
    80      "description": "RunCommand with a write command omits default write concern (runCommand should never inherit write concern)",
    81      "operations": [
    82        {
    83          "object": "database",
    84          "databaseOptions": {
    85            "writeConcern": {}
    86          },
    87          "name": "runCommand",
    88          "command_name": "delete",
    89          "arguments": {
    90            "command": {
    91              "delete": "default_write_concern_coll",
    92              "deletes": [
    93                {
    94                  "q": {},
    95                  "limit": 1
    96                }
    97              ]
    98            }
    99          }
   100        }
   101      ],
   102      "expectations": [
   103        {
   104          "command_started_event": {
   105            "command": {
   106              "delete": "default_write_concern_coll",
   107              "deletes": [
   108                {
   109                  "q": {},
   110                  "limit": 1
   111                }
   112              ],
   113              "writeConcern": null
   114            }
   115          }
   116        }
   117      ]
   118    },
   119    {
   120      "description": "CreateIndex and dropIndex omits default write concern",
   121      "operations": [
   122        {
   123          "object": "collection",
   124          "collectionOptions": {
   125            "writeConcern": {}
   126          },
   127          "name": "createIndex",
   128          "arguments": {
   129            "keys": {
   130              "x": 1
   131            }
   132          }
   133        },
   134        {
   135          "object": "collection",
   136          "collectionOptions": {
   137            "writeConcern": {}
   138          },
   139          "name": "dropIndex",
   140          "arguments": {
   141            "name": "x_1"
   142          }
   143        }
   144      ],
   145      "expectations": [
   146        {
   147          "command_started_event": {
   148            "command": {
   149              "createIndexes": "default_write_concern_coll",
   150              "indexes": [
   151                {
   152                  "name": "x_1",
   153                  "key": {
   154                    "x": 1
   155                  }
   156                }
   157              ],
   158              "writeConcern": null
   159            }
   160          }
   161        },
   162        {
   163          "command_started_event": {
   164            "command": {
   165              "dropIndexes": "default_write_concern_coll",
   166              "index": "x_1",
   167              "writeConcern": null
   168            }
   169          }
   170        }
   171      ]
   172    },
   173    {
   174      "description": "MapReduce omits default write concern",
   175      "operations": [
   176        {
   177          "name": "mapReduce",
   178          "object": "collection",
   179          "collectionOptions": {
   180            "writeConcern": {}
   181          },
   182          "arguments": {
   183            "map": {
   184              "$code": "function inc() { return emit(0, this.x + 1) }"
   185            },
   186            "reduce": {
   187              "$code": "function sum(key, values) { return values.reduce((acc, x) => acc + x); }"
   188            },
   189            "out": {
   190              "inline": 1
   191            }
   192          }
   193        }
   194      ],
   195      "expectations": [
   196        {
   197          "command_started_event": {
   198            "command": {
   199              "mapReduce": "default_write_concern_coll",
   200              "map": {
   201                "$code": "function inc() { return emit(0, this.x + 1) }"
   202              },
   203              "reduce": {
   204                "$code": "function sum(key, values) { return values.reduce((acc, x) => acc + x); }"
   205              },
   206              "out": {
   207                "inline": 1
   208              },
   209              "writeConcern": null
   210            }
   211          }
   212        }
   213      ]
   214    }
   215  ]
   216}

View as plain text