我知道ObjectIds包含它们的创建日期.有没有办法查询ObjectId的这个方面?
我想获取集合中最后创建的文档并返回它们的 objectID 和时间戳。例如,如果昨天我创建了 10 个文档,我想使用 db.collection 返回它们,然后
const lastTimeStamp = will be the timestamp from the last created element
const lastTimeStampArray = will be array of timestamps from yesterdays records
const lastObjectId = will be ObjectID of last created document
const lastObjectIdsArray = array of last objectIds
Run Code Online (Sandbox Code Playgroud)
我在用: