...

Text file src/go.mongodb.org/mongo-driver/testdata/retryable-reads/aggregate.json

Documentation: go.mongodb.org/mongo-driver/testdata/retryable-reads

     1{
     2  "runOn": [
     3    {
     4      "minServerVersion": "4.0",
     5      "topology": [
     6        "single",
     7        "replicaset"
     8      ]
     9    },
    10    {
    11      "minServerVersion": "4.1.7",
    12      "topology": [
    13        "sharded",
    14        "load-balanced"
    15      ]
    16    }
    17  ],
    18  "database_name": "retryable-reads-tests",
    19  "collection_name": "coll",
    20  "data": [
    21    {
    22      "_id": 1,
    23      "x": 11
    24    },
    25    {
    26      "_id": 2,
    27      "x": 22
    28    },
    29    {
    30      "_id": 3,
    31      "x": 33
    32    }
    33  ],
    34  "tests": [
    35    {
    36      "description": "Aggregate succeeds on first attempt",
    37      "operations": [
    38        {
    39          "name": "aggregate",
    40          "object": "collection",
    41          "arguments": {
    42            "pipeline": [
    43              {
    44                "$match": {
    45                  "_id": {
    46                    "$gt": 1
    47                  }
    48                }
    49              },
    50              {
    51                "$sort": {
    52                  "x": 1
    53                }
    54              }
    55            ]
    56          },
    57          "result": [
    58            {
    59              "_id": 2,
    60              "x": 22
    61            },
    62            {
    63              "_id": 3,
    64              "x": 33
    65            }
    66          ]
    67        }
    68      ],
    69      "expectations": [
    70        {
    71          "command_started_event": {
    72            "command": {
    73              "aggregate": "coll",
    74              "pipeline": [
    75                {
    76                  "$match": {
    77                    "_id": {
    78                      "$gt": 1
    79                    }
    80                  }
    81                },
    82                {
    83                  "$sort": {
    84                    "x": 1
    85                  }
    86                }
    87              ]
    88            },
    89            "database_name": "retryable-reads-tests"
    90          }
    91        }
    92      ]
    93    },
    94    {
    95      "description": "Aggregate succeeds on second attempt",
    96      "failPoint": {
    97        "configureFailPoint": "failCommand",
    98        "mode": {
    99          "times": 1
   100        },
   101        "data": {
   102          "failCommands": [
   103            "aggregate"
   104          ],
   105          "closeConnection": true
   106        }
   107      },
   108      "operations": [
   109        {
   110          "name": "aggregate",
   111          "object": "collection",
   112          "arguments": {
   113            "pipeline": [
   114              {
   115                "$match": {
   116                  "_id": {
   117                    "$gt": 1
   118                  }
   119                }
   120              },
   121              {
   122                "$sort": {
   123                  "x": 1
   124                }
   125              }
   126            ]
   127          },
   128          "result": [
   129            {
   130              "_id": 2,
   131              "x": 22
   132            },
   133            {
   134              "_id": 3,
   135              "x": 33
   136            }
   137          ]
   138        }
   139      ],
   140      "expectations": [
   141        {
   142          "command_started_event": {
   143            "command": {
   144              "aggregate": "coll",
   145              "pipeline": [
   146                {
   147                  "$match": {
   148                    "_id": {
   149                      "$gt": 1
   150                    }
   151                  }
   152                },
   153                {
   154                  "$sort": {
   155                    "x": 1
   156                  }
   157                }
   158              ]
   159            },
   160            "database_name": "retryable-reads-tests"
   161          }
   162        },
   163        {
   164          "command_started_event": {
   165            "command": {
   166              "aggregate": "coll",
   167              "pipeline": [
   168                {
   169                  "$match": {
   170                    "_id": {
   171                      "$gt": 1
   172                    }
   173                  }
   174                },
   175                {
   176                  "$sort": {
   177                    "x": 1
   178                  }
   179                }
   180              ]
   181            },
   182            "database_name": "retryable-reads-tests"
   183          }
   184        }
   185      ]
   186    },
   187    {
   188      "description": "Aggregate fails on first attempt",
   189      "clientOptions": {
   190        "retryReads": false
   191      },
   192      "failPoint": {
   193        "configureFailPoint": "failCommand",
   194        "mode": {
   195          "times": 1
   196        },
   197        "data": {
   198          "failCommands": [
   199            "aggregate"
   200          ],
   201          "closeConnection": true
   202        }
   203      },
   204      "operations": [
   205        {
   206          "name": "aggregate",
   207          "object": "collection",
   208          "arguments": {
   209            "pipeline": [
   210              {
   211                "$match": {
   212                  "_id": {
   213                    "$gt": 1
   214                  }
   215                }
   216              },
   217              {
   218                "$sort": {
   219                  "x": 1
   220                }
   221              }
   222            ]
   223          },
   224          "error": true
   225        }
   226      ],
   227      "expectations": [
   228        {
   229          "command_started_event": {
   230            "command": {
   231              "aggregate": "coll",
   232              "pipeline": [
   233                {
   234                  "$match": {
   235                    "_id": {
   236                      "$gt": 1
   237                    }
   238                  }
   239                },
   240                {
   241                  "$sort": {
   242                    "x": 1
   243                  }
   244                }
   245              ]
   246            },
   247            "database_name": "retryable-reads-tests"
   248          }
   249        }
   250      ]
   251    },
   252    {
   253      "description": "Aggregate fails on second attempt",
   254      "failPoint": {
   255        "configureFailPoint": "failCommand",
   256        "mode": {
   257          "times": 2
   258        },
   259        "data": {
   260          "failCommands": [
   261            "aggregate"
   262          ],
   263          "closeConnection": true
   264        }
   265      },
   266      "operations": [
   267        {
   268          "name": "aggregate",
   269          "object": "collection",
   270          "arguments": {
   271            "pipeline": [
   272              {
   273                "$match": {
   274                  "_id": {
   275                    "$gt": 1
   276                  }
   277                }
   278              },
   279              {
   280                "$sort": {
   281                  "x": 1
   282                }
   283              }
   284            ]
   285          },
   286          "error": true
   287        }
   288      ],
   289      "expectations": [
   290        {
   291          "command_started_event": {
   292            "command": {
   293              "aggregate": "coll",
   294              "pipeline": [
   295                {
   296                  "$match": {
   297                    "_id": {
   298                      "$gt": 1
   299                    }
   300                  }
   301                },
   302                {
   303                  "$sort": {
   304                    "x": 1
   305                  }
   306                }
   307              ]
   308            },
   309            "database_name": "retryable-reads-tests"
   310          }
   311        },
   312        {
   313          "command_started_event": {
   314            "command": {
   315              "aggregate": "coll",
   316              "pipeline": [
   317                {
   318                  "$match": {
   319                    "_id": {
   320                      "$gt": 1
   321                    }
   322                  }
   323                },
   324                {
   325                  "$sort": {
   326                    "x": 1
   327                  }
   328                }
   329              ]
   330            },
   331            "database_name": "retryable-reads-tests"
   332          }
   333        }
   334      ]
   335    },
   336    {
   337      "description": "Aggregate with $out does not retry",
   338      "failPoint": {
   339        "configureFailPoint": "failCommand",
   340        "mode": {
   341          "times": 1
   342        },
   343        "data": {
   344          "failCommands": [
   345            "aggregate"
   346          ],
   347          "closeConnection": true
   348        }
   349      },
   350      "operations": [
   351        {
   352          "name": "aggregate",
   353          "object": "collection",
   354          "arguments": {
   355            "pipeline": [
   356              {
   357                "$match": {
   358                  "_id": {
   359                    "$gt": 1
   360                  }
   361                }
   362              },
   363              {
   364                "$sort": {
   365                  "x": 1
   366                }
   367              },
   368              {
   369                "$out": "output-collection"
   370              }
   371            ]
   372          },
   373          "error": true
   374        }
   375      ],
   376      "expectations": [
   377        {
   378          "command_started_event": {
   379            "command": {
   380              "aggregate": "coll",
   381              "pipeline": [
   382                {
   383                  "$match": {
   384                    "_id": {
   385                      "$gt": 1
   386                    }
   387                  }
   388                },
   389                {
   390                  "$sort": {
   391                    "x": 1
   392                  }
   393                },
   394                {
   395                  "$out": "output-collection"
   396                }
   397              ]
   398            },
   399            "command_name": "aggregate",
   400            "database_name": "retryable-reads-tests"
   401          }
   402        }
   403      ]
   404    }
   405  ]
   406}

View as plain text