deno.land / x / mongoose@6.7.5 / lib / options / SchemaStringOptions.js

SchemaStringOptions.js
نووسراو ببینە
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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
'use strict';
const SchemaTypeOptions = require('./SchemaTypeOptions');
/** * The options defined on a string schematype. * * #### Example: * * const schema = new Schema({ name: String }); * schema.path('name').options; // SchemaStringOptions instance * * @api public * @inherits SchemaTypeOptions * @constructor SchemaStringOptions */
class SchemaStringOptions extends SchemaTypeOptions {}
const opts = require('./propertyOptions');
/** * Array of allowed values for this path * * @api public * @property enum * @memberOf SchemaStringOptions * @type {Array} * @instance */
Object.defineProperty(SchemaStringOptions.prototype, 'enum', opts);
/** * Attach a validator that succeeds if the data string matches the given regular * expression, and fails otherwise. * * @api public * @property match * @memberOf SchemaStringOptions * @type {RegExp} * @instance */
Object.defineProperty(SchemaStringOptions.prototype, 'match', opts);
/** * If truthy, Mongoose will add a custom setter that lowercases this string * using JavaScript's built-in `String#toLowerCase()`. * * @api public * @property lowercase * @memberOf SchemaStringOptions * @type {Boolean} * @instance */
Object.defineProperty(SchemaStringOptions.prototype, 'lowercase', opts);
/** * If truthy, Mongoose will add a custom setter that removes leading and trailing * whitespace using [JavaScript's built-in `String#trim()`](https://masteringjs.io/tutorials/fundamentals/trim-string). * * @api public * @property trim * @memberOf SchemaStringOptions * @type {Boolean} * @instance */
Object.defineProperty(SchemaStringOptions.prototype, 'trim', opts);
/** * If truthy, Mongoose will add a custom setter that uppercases this string * using JavaScript's built-in [`String#toUpperCase()`](https://masteringjs.io/tutorials/fundamentals/uppercase). * * @api public * @property uppercase * @memberOf SchemaStringOptions * @type {Boolean} * @instance */
Object.defineProperty(SchemaStringOptions.prototype, 'uppercase', opts);
/** * If set, Mongoose will add a custom validator that ensures the given * string's `length` is at least the given number. * * Mongoose supports two different spellings for this option: `minLength` and `minlength`. * `minLength` is the recommended way to specify this option, but Mongoose also supports * `minlength` (lowercase "l"). * * @api public * @property minLength * @memberOf SchemaStringOptions * @type {Number} * @instance */
Object.defineProperty(SchemaStringOptions.prototype, 'minLength', opts);Object.defineProperty(SchemaStringOptions.prototype, 'minlength', opts);
/** * If set, Mongoose will add a custom validator that ensures the given * string's `length` is at most the given number. * * Mongoose supports two different spellings for this option: `maxLength` and `maxlength`. * `maxLength` is the recommended way to specify this option, but Mongoose also supports * `maxlength` (lowercase "l"). * * @api public * @property maxLength * @memberOf SchemaStringOptions * @type {Number} * @instance */
Object.defineProperty(SchemaStringOptions.prototype, 'maxLength', opts);Object.defineProperty(SchemaStringOptions.prototype, 'maxlength', opts);
/** * Sets default [populate options](/docs/populate.html#query-conditions). * * @api public * @property populate * @memberOf SchemaStringOptions * @type {Object} * @instance */
Object.defineProperty(SchemaStringOptions.prototype, 'populate', opts);
/*! * ignore */
module.exports = SchemaStringOptions;
mongoose

Version Info

Tagged at
a year ago