Database

db={"batches":[{units:130,sku:"HT124"},{units:200,sku:"HT125"}],"products":[{description:"A black Shoe",sku:"HT124"},{description:"A red Shoe",sku:"HT125"}],"sales":[{quantityShipped:100,sku:"HT124"},{quantityShipped:30,sku:"HT125"},{quantityShipped:50,sku:"HT125"}]}

Query

db.products.aggregate([{$lookup:{from:"sales",localField:"sku",foreignField:"sku",as:"sales"}},{$unwind:"$sales"},{$lookup:{from:"batches",localField:"sku",foreignField:"sku",as:"batches"}},{$unwind:"$batches"},{$group:{_id:{productId:"$_id",description:"$description"},totalSales:{$sum:"$sales.quantityShipped"},units:{$first:"$batches.units"}}},{$project:{_id:"$_id.productId",description:"$_id.description",stock:{"$subtract":["$units","$totalSales"]}}}])

Result