summaryrefslogtreecommitdiff
path: root/jstests
diff options
context:
space:
mode:
authorBenety Goh <benety@mongodb.com>2020-11-21 09:53:12 -0500
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2020-11-21 15:12:42 +0000
commit40fb4677db516968c8560b2e7db9c587b887d79a (patch)
tree83f2ddffa9192b048745f31b5263513d529bdf11 /jstests
parent8a8435ba30e2ba76e09ea2992b8dfb3f64246702 (diff)
downloadmongo-40fb4677db516968c8560b2e7db9c587b887d79a.tar.gz
SERVER-52529 enable schema validation on time-series bucket collections
Diffstat (limited to 'jstests')
-rw-r--r--jstests/noPassthroughWithMongod/time_series_create.js25
1 files changed, 16 insertions, 9 deletions
diff --git a/jstests/noPassthroughWithMongod/time_series_create.js b/jstests/noPassthroughWithMongod/time_series_create.js
index bcb98991bfb..72a202dc49c 100644
--- a/jstests/noPassthroughWithMongod/time_series_create.js
+++ b/jstests/noPassthroughWithMongod/time_series_create.js
@@ -130,19 +130,26 @@ testTimeseriesNamespaceExists((testDB, collName) => {
const bucketsColl = testDB.getCollection('system.buckets.' + coll.getName());
assert.commandWorked(bucketsColl.insert(
{control: {version: 1, min: {time: ISODate()}, max: {time: ISODate()}}, data: {}}));
- assert.commandWorked(bucketsColl.insert({
+ assert.commandFailedWithCode(bucketsColl.insert({
control: {version: 'not a number', min: {time: ISODate()}, max: {time: ISODate()}},
data: {}
- }));
- assert.commandWorked(bucketsColl.insert(
- {control: {version: 1, min: {time: 'not a date'}, max: {time: ISODate()}}, data: {}}));
- assert.commandWorked(bucketsColl.insert(
- {control: {version: 1, min: {time: ISODate()}, max: {time: 'not a date'}}, data: {}}));
- assert.commandWorked(bucketsColl.insert({
+ }),
+ ErrorCodes.DocumentValidationFailure);
+ assert.commandFailedWithCode(
+ bucketsColl.insert(
+ {control: {version: 1, min: {time: 'not a date'}, max: {time: ISODate()}}, data: {}}),
+ ErrorCodes.DocumentValidationFailure);
+ assert.commandFailedWithCode(
+ bucketsColl.insert(
+ {control: {version: 1, min: {time: ISODate()}, max: {time: 'not a date'}}, data: {}}),
+ ErrorCodes.DocumentValidationFailure);
+ assert.commandFailedWithCode(bucketsColl.insert({
control: {version: 1, min: {time: ISODate()}, max: {time: ISODate()}},
data: 'not an object'
- }));
- assert.commandWorked(bucketsColl.insert({invalid_bucket_field: 1}));
+ }),
+ ErrorCodes.DocumentValidationFailure);
+ assert.commandFailedWithCode(bucketsColl.insert({invalid_bucket_field: 1}),
+ ErrorCodes.DocumentValidationFailure);
assert.commandWorked(testDB.runCommand({drop: coll.getName(), writeConcern: {w: "majority"}}));
}
})();