sql >> Base de Datos >  >> NoSQL >> MongoDB

¿Cómo calcular la diferencia de marca de tiempo en mongodb (en horas)?

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