schemaUnionOptions.js 739 B

1234567891011121314151617181920212223242526272829303132
  1. 'use strict';
  2. const SchemaTypeOptions = require('./schemaTypeOptions');
  3. /**
  4. * The options defined on a Union schematype.
  5. *
  6. * @api public
  7. * @inherits SchemaTypeOptions
  8. * @constructor SchemaUnionOptions
  9. */
  10. class SchemaUnionOptions extends SchemaTypeOptions {}
  11. const opts = require('./propertyOptions');
  12. /**
  13. * If set, specifies the types that this union can take. Mongoose will cast
  14. * the value to one of the given types.
  15. *
  16. * If not set, Mongoose will not cast the value to any specific type.
  17. *
  18. * @api public
  19. * @property of
  20. * @memberOf SchemaUnionOptions
  21. * @type {Function|Function[]|string|string[]}
  22. * @instance
  23. */
  24. Object.defineProperty(SchemaUnionOptions.prototype, 'of', opts);
  25. module.exports = SchemaUnionOptions;