Database

db={"sample1":[{"_id":{"date":ISODate("2020-02-11T18:30:00.000Z"),"price":4.0,"offer":0.0,"itemCode":"A001","customerId":ObjectId("5e43de778b57693cd46859eb"),"sellerId":ObjectId("5e43e5cdc11f750864f46820")},"charges":168.0},{"_id":{"date":ISODate("2020-02-11T18:30:00.000Z"),"coverPrice":5.5,"offer":38.0,"itemCode":"B001","customerId":ObjectId("5e43de778b57693cd46859eb"),"sellerId":ObjectId("5e43e5cdc11f750864f46820")},"charges":209.5}],"sample2":[{"_id":ObjectId("5e4e3c0dd5b592940ec5f2d6"),"paymentReceivedOnDate":ISODate("2020-02-12T18:30:00.000Z"),"customerId":ObjectId("5e43de778b57693cd46859eb"),"sellerId":ObjectId("5e43e5cdc11f750864f46820"),"amount":30.0},{"_id":ObjectId("5e4e3c0dd5b592940ec5f2d7"),"paymentReceivedOnDate":ISODate("2020-02-12T18:30:00.000Z"),"customerId":ObjectId("5e43de778b57693cd46859eb"),"sellerId":ObjectId("5e43e5cdc11f750864f46820"),"amount":160.0},{"_id":ObjectId("5e4e3c0dd5b592940ec5f2d8"),"paymentReceivedOnDate":ISODate("2020-02-11T18:30:00.000Z"),"customerId":ObjectId("5e43de778b57693cd46859eb"),"sellerId":ObjectId("5e43e5cdc11f750864f46820"),"amount":50.0}]}

Query

db.sample1.aggregate([{$group:{_id:{date:"$_id.date",customerId:"$_id.customerId",sellerId:"$_id.sellerId"},totalCharges:{$sum:"$charges"}}},{$lookup:{from:"sample2",let:{customerId:"$_id.customerId",sellerId:"$_id.sellerId"},pipeline:[{$match:{$expr:{$and:[{$eq:["$customerId","$$customerId"]},{$eq:["$sellerId","$$sellerId"]}]}}},{$project:{amount:1,_id:0}}],as:"TotalAmount"}},{$project:{totalCharges:1,outstanding:{$subtract:["$totalCharges",{$reduce:{input:"$TotalAmount",initialValue:0,in:{$add:["$$value","$$this.amount"]}}}]},TotalAmount:{$reduce:{input:"$TotalAmount",initialValue:0,in:{$add:["$$value","$$this.amount"]}}}}}])

Result