...

Text file src/go.mongodb.org/mongo-driver/testdata/uri-options/read-preference-options.json

Documentation: go.mongodb.org/mongo-driver/testdata/uri-options

     1{
     2  "tests": [
     3    {
     4      "description": "Valid read preference options are parsed correctly",
     5      "uri": "mongodb://example.com/?readPreference=primaryPreferred&readPreferenceTags=dc:ny,rack:1&maxStalenessSeconds=120&readPreferenceTags=dc:ny",
     6      "valid": true,
     7      "warning": false,
     8      "hosts": null,
     9      "auth": null,
    10      "options": {
    11        "readPreference": "primaryPreferred",
    12        "readPreferenceTags": [
    13          {
    14            "dc": "ny",
    15            "rack": "1"
    16          },
    17          {
    18            "dc": "ny"
    19          }
    20        ],
    21        "maxStalenessSeconds": 120
    22      }
    23    },
    24    {
    25      "description": "Single readPreferenceTags is parsed as array of size one",
    26      "uri": "mongodb://example.com/?readPreference=secondary&readPreferenceTags=dc:ny",
    27      "valid": true,
    28      "warning": false,
    29      "hosts": null,
    30      "auth": null,
    31      "options": {
    32        "readPreferenceTags": [
    33          {
    34            "dc": "ny"
    35          }
    36        ]
    37      }
    38    },
    39    {
    40      "description": "Invalid readPreferenceTags causes a warning",
    41      "uri": "mongodb://example.com/?readPreferenceTags=invalid",
    42      "valid": true,
    43      "warning": true,
    44      "hosts": null,
    45      "auth": null,
    46      "options": {}
    47    },
    48    {
    49      "description": "Non-numeric maxStalenessSeconds causes a warning",
    50      "uri": "mongodb://example.com/?maxStalenessSeconds=invalid",
    51      "valid": true,
    52      "warning": true,
    53      "hosts": null,
    54      "auth": null,
    55      "options": {}
    56    },
    57    {
    58      "description": "Too low maxStalenessSeconds causes a warning",
    59      "uri": "mongodb://example.com/?maxStalenessSeconds=-2",
    60      "valid": true,
    61      "warning": true,
    62      "hosts": null,
    63      "auth": null,
    64      "options": {}
    65    }
    66  ]
    67}

View as plain text