Database

[{"orderNo":"123","bags":[{"type":"small","products":[{"id":"1","name":"ABC","returnable":true},{"id":"2","name":"XYZ"}]},{"type":"big","products":[{"id":"3","name":"PQR","returnable":true},{"id":"4","name":"UVW"}]}]}]

Query

db.collection.aggregate([{$project:{totalReturnable:{$reduce:{input:"$bags",initialValue:0,in:{$add:["$$value",{$size:{$filter:{input:"$$this.products",as:"prod",cond:{$eq:["$$prod.returnable",true]}}}}]}}}}}])

Result