diff options
Diffstat (limited to 'jstests/noPassthroughWithMongod/time_series_create.js')
-rw-r--r-- | jstests/noPassthroughWithMongod/time_series_create.js | 25 |
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"}})); } })(); |