summaryrefslogtreecommitdiff
path: root/jstests/core/timeseries/timeseries_bucket_rename.js
blob: 6f98179cf221ee9d6c7a92372f564f973cb7e2e8 (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
/**
 * Tests that a system.buckets collection cannot be renamed.
 *
 * @tags: [
 *   does_not_support_stepdowns,
 *   does_not_support_transactions,
 * ]
 */
(function() {
'use strict';

const coll = db.timeseries_bucket_rename;
const bucketsColl = db.getCollection('system.buckets.' + coll.getName());

const timeFieldName = 'time';

coll.drop();
assert.commandWorked(db.createCollection(coll.getName(), {timeseries: {timeField: timeFieldName}}));
assert.contains(bucketsColl.getName(), db.getCollectionNames());

assert.commandFailedWithCode(db.adminCommand({
    renameCollection: bucketsColl.getFullName(),
    to: db.getName() + ".otherColl",
    dropTarget: false
}),
                             ErrorCodes.IllegalOperation);
})();