SchemaDateOptions.js
1.23 KB
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
'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.
*
* @api public
* @property expires
* @memberOf SchemaDateOptions
* @type Date
* @instance
*/
Object.defineProperty(SchemaDateOptions.prototype, 'expires', opts);
/*!
* ignore
*/
module.exports = SchemaDateOptions;