...

Text file src/go.mongodb.org/mongo-driver/testdata/index-management/createSearchIndexes.json

Documentation: go.mongodb.org/mongo-driver/testdata/index-management

     1{
     2  "description": "createSearchIndexes",
     3  "schemaVersion": "1.4",
     4  "createEntities": [
     5    {
     6      "client": {
     7        "id": "client0",
     8        "useMultipleMongoses": false,
     9        "observeEvents": [
    10          "commandStartedEvent"
    11        ]
    12      }
    13    },
    14    {
    15      "database": {
    16        "id": "database0",
    17        "client": "client0",
    18        "databaseName": "database0"
    19      }
    20    },
    21    {
    22      "collection": {
    23        "id": "collection0",
    24        "database": "database0",
    25        "collectionName": "collection0"
    26      }
    27    }
    28  ],
    29  "runOnRequirements": [
    30    {
    31      "minServerVersion": "7.0.0",
    32      "topologies": [
    33        "replicaset",
    34        "load-balanced",
    35        "sharded"
    36      ],
    37      "serverless": "forbid"
    38    }
    39  ],
    40  "tests": [
    41    {
    42      "description": "empty index definition array",
    43      "operations": [
    44        {
    45          "name": "createSearchIndexes",
    46          "object": "collection0",
    47          "arguments": {
    48            "models": []
    49          },
    50          "expectError": {
    51            "isError": true,
    52            "errorContains": "Atlas"
    53          }
    54        }
    55      ],
    56      "expectEvents": [
    57        {
    58          "client": "client0",
    59          "events": [
    60            {
    61              "commandStartedEvent": {
    62                "command": {
    63                  "createSearchIndexes": "collection0",
    64                  "indexes": [],
    65                  "$db": "database0"
    66                }
    67              }
    68            }
    69          ]
    70        }
    71      ]
    72    },
    73    {
    74      "description": "no name provided for an index definition",
    75      "operations": [
    76        {
    77          "name": "createSearchIndexes",
    78          "object": "collection0",
    79          "arguments": {
    80            "models": [
    81              {
    82                "definition": {
    83                  "mappings": {
    84                    "dynamic": true
    85                  }
    86                }
    87              }
    88            ]
    89          },
    90          "expectError": {
    91            "isError": true,
    92            "errorContains": "Atlas"
    93          }
    94        }
    95      ],
    96      "expectEvents": [
    97        {
    98          "client": "client0",
    99          "events": [
   100            {
   101              "commandStartedEvent": {
   102                "command": {
   103                  "createSearchIndexes": "collection0",
   104                  "indexes": [
   105                    {
   106                      "definition": {
   107                        "mappings": {
   108                          "dynamic": true
   109                        }
   110                      }
   111                    }
   112                  ],
   113                  "$db": "database0"
   114                }
   115              }
   116            }
   117          ]
   118        }
   119      ]
   120    },
   121    {
   122      "description": "name provided for an index definition",
   123      "operations": [
   124        {
   125          "name": "createSearchIndexes",
   126          "object": "collection0",
   127          "arguments": {
   128            "models": [
   129              {
   130                "definition": {
   131                  "mappings": {
   132                    "dynamic": true
   133                  }
   134                },
   135                "name": "test index"
   136              }
   137            ]
   138          },
   139          "expectError": {
   140            "isError": true,
   141            "errorContains": "Atlas"
   142          }
   143        }
   144      ],
   145      "expectEvents": [
   146        {
   147          "client": "client0",
   148          "events": [
   149            {
   150              "commandStartedEvent": {
   151                "command": {
   152                  "createSearchIndexes": "collection0",
   153                  "indexes": [
   154                    {
   155                      "definition": {
   156                        "mappings": {
   157                          "dynamic": true
   158                        }
   159                      },
   160                      "name": "test index"
   161                    }
   162                  ],
   163                  "$db": "database0"
   164                }
   165              }
   166            }
   167          ]
   168        }
   169      ]
   170    }
   171  ]
   172}

View as plain text