Database
db={"agents":[{"_id":ObjectId("5a934e000ac2030405000370"),"name":"Book Now"}],"tolls":[{"_id":ObjectId("5a934e000102030405000000"),"amountCollected":20,"plaza":"Shimabala","directionLane":"South/3","cashier":"Chishala","agent":{"_id":ObjectId("5a934e000ac2030405000370"),"name":"Book Now"},"createdAt":ISODate("2021-06-02T13:23:06.232Z")},{"_id":ObjectId("a9934ec001a203040500dc00"),"amountCollected":150,"plaza":"Shimabala","directionLane":"South/3","cashier":"Chishala","agent":{"_id":ObjectId("5a934e000ac2030405000370"),"name":"Book Now"},"createdAt":ISODate("2021-06-04T13:23:06.232Z")}],"fuel":[{"_id":ObjectId("60b79e4e4afd77a1c27c730c"),"litres":5.2,"price":90,"station":"Chilanga","fuelAttendant":"Manda","agent":{"_id":ObjectId("5a934e000ac2030405000370"),"name":"Book Now"},"createdAt":ISODate("2021-06-04T16:06:16.232Z")}]}
Query
db.tolls.aggregate([{$project:{createdAt:1,type:"tolls"}},{$unionWith:{coll:"fuel",pipeline:[{$project:{createdAt:1,type:"fuel"}}]}},{$group:{_id:{date:{$dateToString:{date:"$createdAt",format:"%Y-%m-%d"}},type:"$type"},count:{$sum:1}}},{$group:{_id:"$_id.date",analytic:{$push:{k:"$_id.type",v:"$count"}}}},{$addFields:{analytic:{$arrayToObject:"$analytic"}}}])