MongoDB
 sql >> Database >  >> NoSQL >> MongoDB

Come calcolare la differenza di timestamp in mongodb (in ore)?

db.collectionname.aggregate([
  {$project: {
      duration: {$divide: [{$subtract: ["$endtime", "$starttime"]}, 3600000]}
  }}
])