MongoDB中每个记录的更新时间 [英] update time of each record in MongoDB

查看:1377
本文介绍了MongoDB中每个记录的更新时间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

MongoDB的ObjectId具有getTimestamp()方法,该方法返回插入记录时的时间.是否有类似的方法来获取上次更新的时间,还是应该使用单独的列来保存此数据?

MongoDB's ObjectId has a getTimestamp() method that returns time when the record was inserted. Is there a similar method for getting time of last update or should I use a separate column to save this data?

使用PHP(如果需要的话).

Using PHP (if it matters).

推荐答案

MongoDB不存储最近的更新,因此您必须通过应用程序将自己存储在单独的字段中.

MongoDB doesn't store the last update so that's something you'll have to store yourself through your application in a separate field.

这篇关于MongoDB中每个记录的更新时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆