...

Text file src/go.mongodb.org/mongo-driver/testdata/collection-management/timeseries-collection.json

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

     1{
     2  "description": "timeseries-collection",
     3  "schemaVersion": "1.0",
     4  "runOnRequirements": [
     5    {
     6      "minServerVersion": "5.0"
     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": "ts-tests"
    23      }
    24    },
    25    {
    26      "collection": {
    27        "id": "collection0",
    28        "database": "database0",
    29        "collectionName": "test"
    30      }
    31    }
    32  ],
    33  "initialData": [
    34    {
    35      "collectionName": "test",
    36      "databaseName": "ts-tests",
    37      "documents": []
    38    }
    39  ],
    40  "tests": [
    41    {
    42      "description": "createCollection with all options",
    43      "operations": [
    44        {
    45          "name": "dropCollection",
    46          "object": "database0",
    47          "arguments": {
    48            "collection": "test"
    49          }
    50        },
    51        {
    52          "name": "createCollection",
    53          "object": "database0",
    54          "arguments": {
    55            "collection": "test",
    56            "expireAfterSeconds": 604800,
    57            "timeseries": {
    58              "timeField": "time",
    59              "metaField": "meta",
    60              "granularity": "minutes"
    61            }
    62          }
    63        },
    64        {
    65          "name": "assertCollectionExists",
    66          "object": "testRunner",
    67          "arguments": {
    68            "databaseName": "ts-tests",
    69            "collectionName": "test"
    70          }
    71        }
    72      ],
    73      "expectEvents": [
    74        {
    75          "client": "client0",
    76          "events": [
    77            {
    78              "commandStartedEvent": {
    79                "command": {
    80                  "drop": "test"
    81                },
    82                "databaseName": "ts-tests"
    83              }
    84            },
    85            {
    86              "commandStartedEvent": {
    87                "command": {
    88                  "create": "test",
    89                  "expireAfterSeconds": 604800,
    90                  "timeseries": {
    91                    "timeField": "time",
    92                    "metaField": "meta",
    93                    "granularity": "minutes"
    94                  }
    95                },
    96                "databaseName": "ts-tests"
    97              }
    98            }
    99          ]
   100        }
   101      ]
   102    },
   103    {
   104      "description": "insertMany with duplicate ids",
   105      "operations": [
   106        {
   107          "name": "dropCollection",
   108          "object": "database0",
   109          "arguments": {
   110            "collection": "test"
   111          }
   112        },
   113        {
   114          "name": "createCollection",
   115          "object": "database0",
   116          "arguments": {
   117            "collection": "test",
   118            "expireAfterSeconds": 604800,
   119            "timeseries": {
   120              "timeField": "time",
   121              "metaField": "meta",
   122              "granularity": "minutes"
   123            }
   124          }
   125        },
   126        {
   127          "name": "assertCollectionExists",
   128          "object": "testRunner",
   129          "arguments": {
   130            "databaseName": "ts-tests",
   131            "collectionName": "test"
   132          }
   133        },
   134        {
   135          "name": "insertMany",
   136          "object": "collection0",
   137          "arguments": {
   138            "documents": [
   139              {
   140                "_id": 1,
   141                "time": {
   142                  "$date": {
   143                    "$numberLong": "1552949630482"
   144                  }
   145                }
   146              },
   147              {
   148                "_id": 1,
   149                "time": {
   150                  "$date": {
   151                    "$numberLong": "1552949630483"
   152                  }
   153                }
   154              }
   155            ]
   156          }
   157        },
   158        {
   159          "name": "find",
   160          "object": "collection0",
   161          "arguments": {
   162            "filter": {},
   163            "sort": {
   164              "time": 1
   165            }
   166          },
   167          "expectResult": [
   168            {
   169              "_id": 1,
   170              "time": {
   171                "$date": {
   172                  "$numberLong": "1552949630482"
   173                }
   174              }
   175            },
   176            {
   177              "_id": 1,
   178              "time": {
   179                "$date": {
   180                  "$numberLong": "1552949630483"
   181                }
   182              }
   183            }
   184          ]
   185        }
   186      ],
   187      "expectEvents": [
   188        {
   189          "client": "client0",
   190          "events": [
   191            {
   192              "commandStartedEvent": {
   193                "command": {
   194                  "drop": "test"
   195                },
   196                "databaseName": "ts-tests"
   197              }
   198            },
   199            {
   200              "commandStartedEvent": {
   201                "command": {
   202                  "create": "test",
   203                  "expireAfterSeconds": 604800,
   204                  "timeseries": {
   205                    "timeField": "time",
   206                    "metaField": "meta",
   207                    "granularity": "minutes"
   208                  }
   209                },
   210                "databaseName": "ts-tests"
   211              }
   212            },
   213            {
   214              "commandStartedEvent": {
   215                "command": {
   216                  "insert": "test",
   217                  "documents": [
   218                    {
   219                      "_id": 1,
   220                      "time": {
   221                        "$date": {
   222                          "$numberLong": "1552949630482"
   223                        }
   224                      }
   225                    },
   226                    {
   227                      "_id": 1,
   228                      "time": {
   229                        "$date": {
   230                          "$numberLong": "1552949630483"
   231                        }
   232                      }
   233                    }
   234                  ]
   235                }
   236              }
   237            },
   238            {
   239              "commandStartedEvent": {
   240                "command": {
   241                  "find": "test",
   242                  "filter": {},
   243                  "sort": {
   244                    "time": 1
   245                  }
   246                },
   247                "databaseName": "ts-tests"
   248              }
   249            }
   250          ]
   251        }
   252      ]
   253    },
   254    {
   255      "description": "createCollection with bucketing options",
   256      "runOnRequirements": [
   257        {
   258          "minServerVersion": "7.0"
   259        }
   260      ],
   261      "operations": [
   262        {
   263          "name": "dropCollection",
   264          "object": "database0",
   265          "arguments": {
   266            "collection": "test"
   267          }
   268        },
   269        {
   270          "name": "createCollection",
   271          "object": "database0",
   272          "arguments": {
   273            "collection": "test",
   274            "timeseries": {
   275              "timeField": "time",
   276              "bucketMaxSpanSeconds": 3600,
   277              "bucketRoundingSeconds": 3600
   278            }
   279          }
   280        },
   281        {
   282          "name": "assertCollectionExists",
   283          "object": "testRunner",
   284          "arguments": {
   285            "databaseName": "ts-tests",
   286            "collectionName": "test"
   287          }
   288        }
   289      ],
   290      "expectEvents": [
   291        {
   292          "client": "client0",
   293          "events": [
   294            {
   295              "commandStartedEvent": {
   296                "command": {
   297                  "drop": "test"
   298                },
   299                "databaseName": "ts-tests"
   300              }
   301            },
   302            {
   303              "commandStartedEvent": {
   304                "command": {
   305                  "create": "test",
   306                  "timeseries": {
   307                    "timeField": "time",
   308                    "bucketMaxSpanSeconds": 3600,
   309                    "bucketRoundingSeconds": 3600
   310                  }
   311                },
   312                "databaseName": "ts-tests"
   313              }
   314            }
   315          ]
   316        }
   317      ]
   318    }
   319  ]
   320}

View as plain text