SchemaDateOptions.js 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. 'use strict';
  2. const SchemaTypeOptions = require('./SchemaTypeOptions');
  3. /**
  4. * The options defined on a Date schematype.
  5. *
  6. * ####Example:
  7. *
  8. * const schema = new Schema({ startedAt: Date });
  9. * schema.path('startedAt').options; // SchemaDateOptions instance
  10. *
  11. * @api public
  12. * @inherits SchemaTypeOptions
  13. * @constructor SchemaDateOptions
  14. */
  15. class SchemaDateOptions extends SchemaTypeOptions {}
  16. const opts = require('./propertyOptions');
  17. /**
  18. * If set, Mongoose adds a validator that checks that this path is after the
  19. * given `min`.
  20. *
  21. * @api public
  22. * @property min
  23. * @memberOf SchemaDateOptions
  24. * @type Date
  25. * @instance
  26. */
  27. Object.defineProperty(SchemaDateOptions.prototype, 'min', opts);
  28. /**
  29. * If set, Mongoose adds a validator that checks that this path is before the
  30. * given `max`.
  31. *
  32. * @api public
  33. * @property max
  34. * @memberOf SchemaDateOptions
  35. * @type Date
  36. * @instance
  37. */
  38. Object.defineProperty(SchemaDateOptions.prototype, 'max', opts);
  39. /**
  40. * If set, Mongoose creates a TTL index on this path.
  41. *
  42. * @api public
  43. * @property expires
  44. * @memberOf SchemaDateOptions
  45. * @type Date
  46. * @instance
  47. */
  48. Object.defineProperty(SchemaDateOptions.prototype, 'expires', opts);
  49. /*!
  50. * ignore
  51. */
  52. module.exports = SchemaDateOptions;