UNPKG

1.26 kBJavaScriptView Raw
1'use strict';
2
3const SchemaTypeOptions = require('./SchemaTypeOptions');
4
5/**
6 * The options defined on a Date schematype.
7 *
8 * ####Example:
9 *
10 * const schema = new Schema({ startedAt: Date });
11 * schema.path('startedAt').options; // SchemaDateOptions instance
12 *
13 * @api public
14 * @inherits SchemaTypeOptions
15 * @constructor SchemaDateOptions
16 */
17
18class SchemaDateOptions extends SchemaTypeOptions {}
19
20const opts = require('./propertyOptions');
21
22/**
23 * If set, Mongoose adds a validator that checks that this path is after the
24 * given `min`.
25 *
26 * @api public
27 * @property min
28 * @memberOf SchemaDateOptions
29 * @type Date
30 * @instance
31 */
32
33Object.defineProperty(SchemaDateOptions.prototype, 'min', opts);
34
35/**
36 * If set, Mongoose adds a validator that checks that this path is before the
37 * given `max`.
38 *
39 * @api public
40 * @property max
41 * @memberOf SchemaDateOptions
42 * @type Date
43 * @instance
44 */
45
46Object.defineProperty(SchemaDateOptions.prototype, 'max', opts);
47
48/**
49 * If set, Mongoose creates a TTL index on this path.
50 *
51 * @api public
52 * @property expires
53 * @memberOf SchemaDateOptions
54 * @type Date
55 * @instance
56 */
57
58Object.defineProperty(SchemaDateOptions.prototype, 'expires', opts);
59
60/*!
61 * ignore
62 */
63
64module.exports = SchemaDateOptions;
\No newline at end of file