Which SchemaType in Mongoose is Best for Timestamp?

后端 未结 6 1777
予麋鹿
予麋鹿 2020-12-07 16:08

I\'m using Mongoose, MongoDB, and Node.

I would like to define a schema where one of its fields is a date\\timestamp.

I would like to use this field in order

6条回答
  •  渐次进展
    2020-12-07 16:58

    I would like to use this field in order to return all the records that have been updated in the last 5 minutes.

    This means you need to update the date to "now" every time you save the object. Maybe you'll find this useful: Moongoose create-modified plugin

提交回复
热议问题