summaryrefslogtreecommitdiff
path: root/jstests/core/timeseries/timeseries_index.js
diff options
context:
space:
mode:
authorBenety Goh <benety@mongodb.com>2021-03-05 05:38:14 -0500
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2021-03-05 11:06:26 +0000
commit546ec2777f2da71903aca5d881c1cf7a9d73bc22 (patch)
treed27d6b0dffeecda4af5ca07b4476ead6eab0afa0 /jstests/core/timeseries/timeseries_index.js
parentfa520cefd45e1b05af43a7e67f711a887270f994 (diff)
downloadmongo-546ec2777f2da71903aca5d881c1cf7a9d73bc22.tar.gz
SERVER-54646 support hidden index creation on time-series collections
Diffstat (limited to 'jstests/core/timeseries/timeseries_index.js')
-rw-r--r--jstests/core/timeseries/timeseries_index.js9
1 files changed, 9 insertions, 0 deletions
diff --git a/jstests/core/timeseries/timeseries_index.js b/jstests/core/timeseries/timeseries_index.js
index aea04bea3e2..26a1524538b 100644
--- a/jstests/core/timeseries/timeseries_index.js
+++ b/jstests/core/timeseries/timeseries_index.js
@@ -108,6 +108,15 @@ const runTest = function(keyForCreate, hint) {
assert.commandWorked(coll.unhideIndex(keyForCreate), 'failed to unhide index: hide2');
assert.eq(1, bucketsColl.find().hint(hint).toArray().length);
assert.commandWorked(coll.dropIndex('hide2'), 'failed to drop index: hide2');
+
+ // Check that we are able to create the index as hidden.
+ assert.commandWorked(coll.createIndex(keyForCreate, {name: 'hide3', hidden: true}),
+ 'failed to create index: ' + tojson(keyForCreate));
+ assert.commandFailedWithCode(assert.throws(() => bucketsColl.find().hint(hint).toArray()),
+ ErrorCodes.BadValue);
+ assert.commandWorked(coll.unhideIndex(keyForCreate), 'failed to unhide index: hide3');
+ assert.eq(1, bucketsColl.find().hint(hint).toArray().length);
+ assert.commandWorked(coll.dropIndex('hide3'), 'failed to drop index: hide2');
};
runTest({[metaFieldName]: 1}, {meta: 1});