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