* Single nested subdocument SchemaType constructor. * * @param {Schema} schema * @param {String} path * @param {Object} options * @inherits SchemaType * @api public
(schema, path, options)
| 36 | */ |
| 37 | |
| 38 | function SubdocumentPath(schema, path, options) { |
| 39 | if (schema.options.timeseries) { |
| 40 | throw new InvalidSchemaOptionError(path, 'timeseries'); |
| 41 | } |
| 42 | const schemaTypeIdOption = SubdocumentPath.defaultOptions && |
| 43 | SubdocumentPath.defaultOptions._id; |
| 44 | if (schemaTypeIdOption != null) { |
| 45 | options = options || {}; |
| 46 | options._id = schemaTypeIdOption; |
| 47 | } |
| 48 | |
| 49 | schema = handleIdOption(schema, options); |
| 50 | |
| 51 | this.caster = _createConstructor(schema, null, options); |
| 52 | this.caster.path = path; |
| 53 | this.caster.prototype.$basePath = path; |
| 54 | this.schema = schema; |
| 55 | this.$isSingleNested = true; |
| 56 | this.base = schema.base; |
| 57 | SchemaType.call(this, path, options, 'Embedded'); |
| 58 | } |
| 59 | |
| 60 | /*! |
| 61 | * ignore |
nothing calls this directly
no test coverage detected