File tree 12 files changed +140
-25
lines changed
12 files changed +140
-25
lines changed Original file line number Diff line number Diff line change @@ -16,15 +16,16 @@ block content
16
16
div.api-nav
17
17
div.api-nav-content
18
18
each item in docs
19
- div.nav-item ( id ='nav-' + item .name )
20
- div.nav-item-title
21
- a( href ='./api/' + item .name .toLowerCase () + '.html' )
22
- | #{item .name }
23
- ul.nav-item-sub
24
- each prop in item .props
25
- li
26
- a( href ='./api/' + item .name .toLowerCase () + '.html#' + prop .anchorId )
27
- | #{prop .string }
19
+ - if (! item .hideFromNav )
20
+ div.nav-item ( id ='nav-' + item .name )
21
+ div.nav-item-title
22
+ a( href ='./api/' + item .name .toLowerCase () + '.html' )
23
+ | #{item .name }
24
+ ul.nav-item-sub
25
+ each prop in item .props
26
+ li
27
+ a( href ='./api/' + item .name .toLowerCase () + '.html#' + prop .anchorId )
28
+ | #{prop .string }
28
29
29
30
each item in docs
30
31
hr.separate-api
Original file line number Diff line number Diff line change @@ -25,20 +25,21 @@ block content
25
25
div.api-nav
26
26
div.api-nav-content
27
27
each item in docs
28
- div.nav-item ( id ='nav-' + item .name )
29
- - if (item .name === name)
30
- div.nav-item-title ( style ="font-weight: bold" )
31
- a( href =item .name .toLowerCase () + '.html' )
32
- | #{item .name }
33
- ul.nav-item-sub
34
- each prop in item .props
35
- li
36
- a( href ='#' + prop .anchorId )
37
- | #{prop .string }
38
- - else
39
- div.nav-item-title
40
- a( href =item .name .toLowerCase () + '.html' )
41
- | #{item .name }
28
+ - if (! item .hideFromNav || item .name === name)
29
+ div.nav-item ( id ='nav-' + item .name )
30
+ - if (item .name === name)
31
+ div.nav-item-title ( style ="font-weight: bold" )
32
+ a( href =item .name .toLowerCase () + '.html' )
33
+ | #{item .name }
34
+ ul.nav-item-sub
35
+ each prop in item .props
36
+ li
37
+ a( href ='#' + prop .anchorId )
38
+ | #{prop .string }
39
+ - else
40
+ div.nav-item-title
41
+ a( href =item .name .toLowerCase () + '.html' )
42
+ | #{item .name }
42
43
43
44
div.api-content
44
45
ul
Original file line number Diff line number Diff line change @@ -24,7 +24,14 @@ const files = [
24
24
'lib/virtualtype.js' ,
25
25
'lib/error/index.js' ,
26
26
'lib/types/core_array.js' ,
27
- 'lib/schema/SingleNestedPath.js'
27
+ 'lib/schema/SingleNestedPath.js' ,
28
+ 'lib/options/SchemaTypeOptions.js' ,
29
+ 'lib/options/SchemaArrayOptions.js' ,
30
+ 'lib/options/SchemaBufferOptions.js' ,
31
+ 'lib/options/SchemaDateOptions.js' ,
32
+ 'lib/options/SchemaNumberOptions.js' ,
33
+ 'lib/options/SchemaObjectIdOptions.js' ,
34
+ 'lib/options/SchemaStringOptions.js'
28
35
] ;
29
36
30
37
module . exports = {
@@ -83,6 +90,9 @@ function parse() {
83
90
ctx . name = str ;
84
91
ctx . string = `${ ctx . constructor } .prototype.${ ctx . name } ` ;
85
92
break ;
93
+ case 'type' :
94
+ ctx . type = Array . isArray ( tag . types ) ? tag . types . join ( '|' ) : tag . types ;
95
+ break ;
86
96
case 'static' :
87
97
ctx . type = 'property' ;
88
98
ctx . static = true ;
@@ -164,6 +174,10 @@ function parse() {
164
174
}
165
175
} ) ;
166
176
177
+ if ( props . file . startsWith ( 'lib/options' ) ) {
178
+ data . hideFromNav = true ;
179
+ }
180
+
167
181
out . push ( data ) ;
168
182
}
169
183
}
Original file line number Diff line number Diff line change @@ -1015,6 +1015,15 @@ Mongoose.prototype.now = function now() { return new Date(); };
1015
1015
1016
1016
Mongoose . prototype . CastError = require ( './error/cast' ) ;
1017
1017
1018
+ /**
1019
+ * The constructor used for schematype options
1020
+ *
1021
+ * @method SchemaTypeOptions
1022
+ * @api public
1023
+ */
1024
+
1025
+ Mongoose . prototype . SchemaTypeOptions = require ( './options/SchemaTypeOptions' ) ;
1026
+
1018
1027
/**
1019
1028
* The [node-mongodb-native](https://github.com/mongodb/node-mongodb-native) driver Mongoose uses.
1020
1029
*
Original file line number Diff line number Diff line change 2
2
3
3
const SchemaTypeOptions = require ( './SchemaTypeOptions' ) ;
4
4
5
+ /**
6
+ * The options defined on an Array schematype.
7
+ *
8
+ * ####Example:
9
+ *
10
+ * const schema = new Schema({ tags: [String] });
11
+ * schema.path('tags').options; // SchemaArrayOptions instance
12
+ *
13
+ * @api public
14
+ * @inherits SchemaTypeOptions
15
+ * @constructor SchemaArrayOptions
16
+ */
17
+
5
18
class SchemaArrayOptions extends SchemaTypeOptions { }
6
19
7
20
const opts = {
Original file line number Diff line number Diff line change 2
2
3
3
const SchemaTypeOptions = require ( './SchemaTypeOptions' ) ;
4
4
5
+ /**
6
+ * The options defined on a Buffer schematype.
7
+ *
8
+ * ####Example:
9
+ *
10
+ * const schema = new Schema({ bitmap: Buffer });
11
+ * schema.path('bitmap').options; // SchemaBufferOptions instance
12
+ *
13
+ * @api public
14
+ * @inherits SchemaTypeOptions
15
+ * @constructor SchemaBufferOptions
16
+ */
17
+
5
18
class SchemaBufferOptions extends SchemaTypeOptions { }
6
19
7
20
const opts = {
Original file line number Diff line number Diff line change 2
2
3
3
const SchemaTypeOptions = require ( './SchemaTypeOptions' ) ;
4
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
+
5
18
class SchemaDateOptions extends SchemaTypeOptions { }
6
19
7
20
const opts = {
Original file line number Diff line number Diff line change 2
2
3
3
const SchemaTypeOptions = require ( './SchemaTypeOptions' ) ;
4
4
5
+ /**
6
+ * The options defined on a Number schematype.
7
+ *
8
+ * ####Example:
9
+ *
10
+ * const schema = new Schema({ count: Number });
11
+ * schema.path('count').options; // SchemaNumberOptions instance
12
+ *
13
+ * @api public
14
+ * @inherits SchemaTypeOptions
15
+ * @constructor SchemaNumberOptions
16
+ */
17
+
5
18
class SchemaNumberOptions extends SchemaTypeOptions { }
6
19
7
20
const opts = {
Original file line number Diff line number Diff line change 2
2
3
3
const SchemaTypeOptions = require ( './SchemaTypeOptions' ) ;
4
4
5
+ /**
6
+ * The options defined on an ObjectId schematype.
7
+ *
8
+ * ####Example:
9
+ *
10
+ * const schema = new Schema({ testId: mongoose.ObjectId });
11
+ * schema.path('testId').options; // SchemaObjectIdOptions instance
12
+ *
13
+ * @api public
14
+ * @inherits SchemaTypeOptions
15
+ * @constructor SchemaObjectIdOptions
16
+ */
17
+
5
18
class SchemaObjectIdOptions extends SchemaTypeOptions { }
6
19
7
20
const opts = {
Original file line number Diff line number Diff line change 2
2
3
3
const SchemaTypeOptions = require ( './SchemaTypeOptions' ) ;
4
4
5
+ /**
6
+ * The options defined on a string schematype.
7
+ *
8
+ * ####Example:
9
+ *
10
+ * const schema = new Schema({ name: String });
11
+ * schema.path('name').options; // SchemaStringOptions instance
12
+ *
13
+ * @api public
14
+ * @inherits SchemaTypeOptions
15
+ * @constructor SchemaStringOptions
16
+ */
17
+
5
18
class SchemaStringOptions extends SchemaTypeOptions { }
6
19
7
20
const opts = {
Original file line number Diff line number Diff line change 2
2
3
3
const utils = require ( '../utils' ) ;
4
4
5
+ /**
6
+ * The options defined on a schematype.
7
+ *
8
+ * ####Example:
9
+ *
10
+ * const schema = new Schema({ name: String });
11
+ * schema.path('name').options instanceof mongoose.SchemaTypeOptions; // true
12
+ *
13
+ * @api public
14
+ * @constructor SchemaTypeOptions
15
+ */
16
+
5
17
class SchemaTypeOptions {
6
18
constructor ( obj ) {
7
19
if ( obj == null ) {
Original file line number Diff line number Diff line change @@ -29,7 +29,7 @@ const ValidatorError = MongooseError.ValidatorError;
29
29
* schema.path('name') instanceof SchemaType; // true
30
30
*
31
31
* @param {String } path
32
- * @param {Object } [options]
32
+ * @param {SchemaTypeOptions } [options] See [SchemaTypeOptions docs](/docs/api/schematypeoptions.html)
33
33
* @param {String } [instance]
34
34
* @api public
35
35
*/
You can’t perform that action at this time.
0 commit comments