How to retrieve last update time of each document in MongoDB?

后端 未结 4 817
后悔当初
后悔当初 2021-02-12 12:18

I would like to know if there is a way to get the last update/modify time of data (i.e documents) in a collection in MongoDB. More clearly, I want to make a query to retrieve al

4条回答
  •  滥情空心
    2021-02-12 12:47

    No, MongoDB by itself does not store either creation or update timestamps. You have to do that yourself (and as you have found out, if you use an ObjectID _id then you get the creation date already).

提交回复
热议问题