SchemaDateOptions
SchemaDateOptions()SchemaDateOptions.prototype.expiresSchemaDateOptions.prototype.maxSchemaDateOptions.prototype.min
SchemaDateOptions()
类型
- «构造函数»
继承
在日期模式类型上定义的选项。
示例
const schema = new Schema({ startedAt: Date });
schema.path('startedAt').options; // SchemaDateOptions instance SchemaDateOptions.prototype.expires
类型
- «日期»
如果设置,Mongoose 将在此路径上创建一个 TTL 索引。
mongo TTL 索引 expireAfterSeconds 值将以秒为单位获取“expires”值。
示例
const schema = new Schema({ "expireAt": { type: Date, expires: 11 } });
// if 'expireAt' is set, then document expires at expireAt + 11 seconds SchemaDateOptions.prototype.max
类型
- «日期»
如果设置,Mongoose 将添加一个验证器,用于检查此路径是否早于给定的 max。
SchemaDateOptions.prototype.min
类型
- «日期»
如果设置,Mongoose 将添加一个验证器,用于检查此路径是否晚于给定的 min。

