...

Text file src/go.mongodb.org/mongo-driver/testdata/crud/unified/aggregate-merge.json

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

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

View as plain text