summaryrefslogtreecommitdiff
path: root/jstests/noPassthrough/timeseries_startup.js
blob: e9999cc134d5cd49cf7c465a6ef15d3413d5cb51 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
/**
 * Tests that the server can startup with time-series collections present.
 *
 * @tags: [
 *   requires_persistence,
 * ]
 */
(function() {
"use strict";

let conn = MongoRunner.runMongod();

const dbName = jsTestName();
const testDB = conn.getDB(dbName);
const coll = testDB.getCollection('t');

const timeFieldName = 'time';
const metaFieldName = 'meta';

assert.commandWorked(testDB.createCollection(
    coll.getName(), {timeseries: {timeField: timeFieldName, metaField: metaFieldName}}));

MongoRunner.stopMongod(conn);

// Restarting the server with a time-series collection present should startup, even though
// time-series collections do not have an _id index.
conn = MongoRunner.runMongod({dbpath: conn.dbpath, noCleanData: true});
assert(conn);
MongoRunner.stopMongod(conn);
})();