All files / mongoose/lib/options schemaDateOptions.js

100% Statements 6/6
100% Branches 0/0
100% Functions 0/0
100% Lines 6/6

Press n or j to go to the next uncovered block, b, p or k for the previous block.

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 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72    1x                                 1x                         1x                         1x                                     1x           1x  
'use strict';
 
const SchemaTypeOptions = require('./schemaTypeOptions');
 
/**
 * The options defined on a Date schematype.
 *
 * #### Example:
 *
 *     const schema = new Schema({ startedAt: Date });
 *     schema.path('startedAt').options; // SchemaDateOptions instance
 *
 * @api public
 * @inherits SchemaTypeOptions
 * @constructor SchemaDateOptions
 */
 
class SchemaDateOptions extends SchemaTypeOptions {}
 
const opts = require('./propertyOptions');
 
/**
 * If set, Mongoose adds a validator that checks that this path is after the
 * given `min`.
 *
 * @api public
 * @property min
 * @memberOf SchemaDateOptions
 * @type {Date}
 * @instance
 */
 
Object.defineProperty(SchemaDateOptions.prototype, 'min', opts);
 
/**
 * If set, Mongoose adds a validator that checks that this path is before the
 * given `max`.
 *
 * @api public
 * @property max
 * @memberOf SchemaDateOptions
 * @type {Date}
 * @instance
 */
 
Object.defineProperty(SchemaDateOptions.prototype, 'max', opts);
 
/**
 * If set, Mongoose creates a TTL index on this path.
 *
 * mongo TTL index `expireAfterSeconds` value will take 'expires' value expressed in seconds.
 *
 * #### Example:
 *
 *     const schema = new Schema({ "expireAt": { type: Date,  expires: 11 } });
 *     // if 'expireAt' is set, then document expires at expireAt + 11 seconds
 *
 * @api public
 * @property expires
 * @memberOf SchemaDateOptions
 * @type {Date}
 * @instance
 */
 
Object.defineProperty(SchemaDateOptions.prototype, 'expires', opts);
 
/*!
 * ignore
 */
 
module.exports = SchemaDateOptions;