billing_model.aggregate()
.match({ 'accoundOid': new mongoose.Types.ObjectId('57264747183a9cf2411896d2') })
.group({ _id: '$service', time: { $sum: { $subtract: [ '$end', '$start' ] } } })
.exec (err, result) ->
if err then return done(err)
done(null, result)
true
Can not match based on ObjectId, the results set to mongodb is
db.billings.aggregate([ { $match: { accountOid: 57264747183a9cf2411896d2 } }, { $group: {_id: "$service", time: { $sum: { $subtract: [ "$end", "$start" ] } } } } ]);
Which does not working, you must of ObjectId around accountOid value.