Here\'s my data:
[ { id: 1, starttime: ISODate(\"2015-08-24T00:00:00.000Z\"), endtime: ISODate(\"2015-08-24T07:00:00.000Z\") },
db.collectionname.aggregate([ {$project: { duration: {$divide: [{$subtract: ["$endtime", "$starttime"]}, 3600000]} }} ])