UNPKG

1.03 kBJavaScriptView Raw
1'use strict';
2
3const SchemaTypeOptions = require('./SchemaTypeOptions');
4
5/**
6 * The options defined on a single nested schematype.
7 *
8 * ####Example:
9 *
10 * const schema = Schema({ child: Schema({ name: String }) });
11 * schema.path('child').options; // SchemaSingleNestedOptions instance
12 *
13 * @api public
14 * @inherits SchemaTypeOptions
15 * @constructor SchemaSingleNestedOptions
16 */
17
18class SchemaSingleNestedOptions extends SchemaTypeOptions {}
19
20const opts = require('./propertyOptions');
21
22/**
23 * If set, overwrites the child schema's `_id` option.
24 *
25 * ####Example:
26 *
27 * const childSchema = Schema({ name: String });
28 * const parentSchema = Schema({
29 * child: { type: childSchema, _id: false }
30 * });
31 * parentSchema.path('child').schema.options._id; // false
32 *
33 * @api public
34 * @property of
35 * @memberOf SchemaSingleNestedOptions
36 * @type Function|string
37 * @instance
38 */
39
40Object.defineProperty(SchemaSingleNestedOptions.prototype, '_id', opts);
41
42module.exports = SchemaSingleNestedOptions;
\No newline at end of file