Getting timestamp from mongodb id

前端 未结 8 1776
误落风尘
误落风尘 2020-12-02 08:38

How do I get the timestamp from the MongoDB id?

8条回答
  •  时光说笑
    2020-12-02 09:10

    Find on mongoDB

    db.books.find({}).limit(10).map(function (v) {
     let data = v
     data.my_date = v._id.getTimestamp()
     return data
    })
    

提交回复
热议问题