...

Text file src/go.mongodb.org/mongo-driver/testdata/retryable-reads/distinct.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": "Distinct succeeds on first attempt",
    37      "operations": [
    38        {
    39          "name": "distinct",
    40          "object": "collection",
    41          "arguments": {
    42            "fieldName": "x",
    43            "filter": {
    44              "_id": {
    45                "$gt": 1
    46              }
    47            }
    48          },
    49          "result": [
    50            22,
    51            33
    52          ]
    53        }
    54      ],
    55      "expectations": [
    56        {
    57          "command_started_event": {
    58            "command": {
    59              "distinct": "coll",
    60              "key": "x",
    61              "query": {
    62                "_id": {
    63                  "$gt": 1
    64                }
    65              }
    66            },
    67            "database_name": "retryable-reads-tests"
    68          }
    69        }
    70      ]
    71    },
    72    {
    73      "description": "Distinct succeeds on second attempt",
    74      "failPoint": {
    75        "configureFailPoint": "failCommand",
    76        "mode": {
    77          "times": 1
    78        },
    79        "data": {
    80          "failCommands": [
    81            "distinct"
    82          ],
    83          "closeConnection": true
    84        }
    85      },
    86      "operations": [
    87        {
    88          "name": "distinct",
    89          "object": "collection",
    90          "arguments": {
    91            "fieldName": "x",
    92            "filter": {
    93              "_id": {
    94                "$gt": 1
    95              }
    96            }
    97          },
    98          "result": [
    99            22,
   100            33
   101          ]
   102        }
   103      ],
   104      "expectations": [
   105        {
   106          "command_started_event": {
   107            "command": {
   108              "distinct": "coll",
   109              "key": "x",
   110              "query": {
   111                "_id": {
   112                  "$gt": 1
   113                }
   114              }
   115            },
   116            "database_name": "retryable-reads-tests"
   117          }
   118        },
   119        {
   120          "command_started_event": {
   121            "command": {
   122              "distinct": "coll",
   123              "key": "x",
   124              "query": {
   125                "_id": {
   126                  "$gt": 1
   127                }
   128              }
   129            },
   130            "database_name": "retryable-reads-tests"
   131          }
   132        }
   133      ]
   134    },
   135    {
   136      "description": "Distinct fails on first attempt",
   137      "clientOptions": {
   138        "retryReads": false
   139      },
   140      "failPoint": {
   141        "configureFailPoint": "failCommand",
   142        "mode": {
   143          "times": 1
   144        },
   145        "data": {
   146          "failCommands": [
   147            "distinct"
   148          ],
   149          "closeConnection": true
   150        }
   151      },
   152      "operations": [
   153        {
   154          "name": "distinct",
   155          "object": "collection",
   156          "arguments": {
   157            "fieldName": "x",
   158            "filter": {
   159              "_id": {
   160                "$gt": 1
   161              }
   162            }
   163          },
   164          "error": true
   165        }
   166      ],
   167      "expectations": [
   168        {
   169          "command_started_event": {
   170            "command": {
   171              "distinct": "coll",
   172              "key": "x",
   173              "query": {
   174                "_id": {
   175                  "$gt": 1
   176                }
   177              }
   178            },
   179            "database_name": "retryable-reads-tests"
   180          }
   181        }
   182      ]
   183    },
   184    {
   185      "description": "Distinct fails on second attempt",
   186      "failPoint": {
   187        "configureFailPoint": "failCommand",
   188        "mode": {
   189          "times": 2
   190        },
   191        "data": {
   192          "failCommands": [
   193            "distinct"
   194          ],
   195          "closeConnection": true
   196        }
   197      },
   198      "operations": [
   199        {
   200          "name": "distinct",
   201          "object": "collection",
   202          "arguments": {
   203            "fieldName": "x",
   204            "filter": {
   205              "_id": {
   206                "$gt": 1
   207              }
   208            }
   209          },
   210          "error": true
   211        }
   212      ],
   213      "expectations": [
   214        {
   215          "command_started_event": {
   216            "command": {
   217              "distinct": "coll",
   218              "key": "x",
   219              "query": {
   220                "_id": {
   221                  "$gt": 1
   222                }
   223              }
   224            },
   225            "database_name": "retryable-reads-tests"
   226          }
   227        },
   228        {
   229          "command_started_event": {
   230            "command": {
   231              "distinct": "coll",
   232              "key": "x",
   233              "query": {
   234                "_id": {
   235                  "$gt": 1
   236                }
   237              }
   238            },
   239            "database_name": "retryable-reads-tests"
   240          }
   241        }
   242      ]
   243    }
   244  ]
   245}

View as plain text