diff options
Diffstat (limited to 'jstests/core/ttl_index_options.js')
| -rw-r--r-- | jstests/core/ttl_index_options.js | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/jstests/core/ttl_index_options.js b/jstests/core/ttl_index_options.js index 47ae2709073..b136680edc4 100644 --- a/jstests/core/ttl_index_options.js +++ b/jstests/core/ttl_index_options.js @@ -1,7 +1,10 @@ /** * Ensures that the options passed in for TTL indexes are validated during index creation. * - * @tags: [requires_ttl_index] + * @tags: [ + * requires_fcv_60, + * requires_ttl_index, + * ] */ (function() { 'use strict'; @@ -16,11 +19,10 @@ assert.commandFailedWithCode( assert.commandFailedWithCode(coll.createIndexes([{x: 1}], {expireAfterSeconds: 9999999999999999}), ErrorCodes.CannotCreateIndex); -// Ensure that we cannot provide a time that is larger than the current epoch time. -let secondsSinceEpoch = Date.now() / 1000; -assert.commandFailedWithCode( - coll.createIndexes([{x: 1}], {expireAfterSeconds: secondsSinceEpoch + 1000}), - ErrorCodes.CannotCreateIndex); +// Ensure that we can provide a time that is larger than the current epoch time. +let secondsSinceEpoch = Math.floor(Date.now() / 1000); +assert.commandWorked( + coll.createIndexes([{x_before_epoch: 1}], {expireAfterSeconds: secondsSinceEpoch + 1000})); // 'expireAfterSeconds' cannot be less than 0. assert.commandFailedWithCode(coll.createIndexes([{x: 1}], {expireAfterSeconds: -1}), |
