mongo文档【tblEvent】如下:

{
    "_id" : ObjectId("5a0415f9bf28b684b1c7f5b2"),
    "citycode" : 3501,
    "startTime" : ISODate("2016-01-02T00:00:00.000+0800"),
    "endTime" : ISODate("2016-12-31T23:59:00.000+0800"),
    "eType" : 2,

}

给文档startTime加一天:

db.tblEvent.find().forEach(
   function(item){                
       db.tblEvent.update({"_id":item._id},{"$set":{"startTime":new Date(item.startTime.getTime() + 1*24*60*60000)}},false,true)
     }
)

其中:

1 day = 1*24*60*60000 = 1 x 24 hours x 60 minutes x 60 seconds x 1000 milliseconds

相关文章:

  • 2021-11-05
  • 2021-10-09
  • 2022-12-23
  • 2021-11-29
  • 2021-08-20
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-04-27
  • 2022-12-23
  • 2021-08-09
  • 2021-07-10
  • 2021-12-21
  • 2021-07-15
相关资源
相似解决方案