SchemaDateOptions


SchemaDateOptions()

タイプ
  • «constructor»
継承

日付 schematype で定義されているオプション。

const schema = new Schema({ startedAt: Date });
schema.path('startedAt').options; // SchemaDateOptions instance

SchemaDateOptions.prototype.expires

タイプ
  • «Date»

設定されている場合、Mongoose はこのパスに TTL インデックスを作成します。

mongo TTL インデックスの expireAfterSeconds 値は、秒単位で表現された「有効期限」の値をとります。

const schema = new Schema({ "expireAt": { type: Date,  expires: 11 } });
// if 'expireAt' is set, then document expires at expireAt + 11 seconds

SchemaDateOptions.prototype.max

タイプ
  • «Date»

設定されている場合、Mongoose は、このパスが指定した max より前であることを確認するためのバリデーターを追加します。


SchemaDateOptions.prototype.min

タイプ
  • «Date»

設定されている場合、Mongoose は、このパスが指定した min より後であることを確認するためのバリデーターを追加します。