SchemaArrayOptions.js 821 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. 'use strict';
  2. const SchemaTypeOptions = require('./SchemaTypeOptions');
  3. /**
  4. * The options defined on an Array schematype.
  5. *
  6. * ####Example:
  7. *
  8. * const schema = new Schema({ tags: [String] });
  9. * schema.path('tags').options; // SchemaArrayOptions instance
  10. *
  11. * @api public
  12. * @inherits SchemaTypeOptions
  13. * @constructor SchemaArrayOptions
  14. */
  15. class SchemaArrayOptions extends SchemaTypeOptions {}
  16. const opts = require('./propertyOptions');
  17. /**
  18. * If this is an array of strings, an array of allowed values for this path.
  19. * Throws an error if this array isn't an array of strings.
  20. *
  21. * @api public
  22. * @property enum
  23. * @memberOf SchemaArrayOptions
  24. * @type Array
  25. * @instance
  26. */
  27. Object.defineProperty(SchemaArrayOptions.prototype, 'enum', opts);
  28. /*!
  29. * ignore
  30. */
  31. module.exports = SchemaArrayOptions;