Database
db={"books":[{isbn:"0001",title:"Book1",pages:NumberInt("150"),price:NumberDecimal("321.2"),copies:NumberInt("3"),language:"english",author:["Author1"],category:["Space Opera"],genre:["Genre-1","Genre-2"],character:["Character-1","Character-2"]}],"orders":[{orderNo:"3",customerNo:"0003",date:{day:NumberInt("25"),month:NumberInt("02"),year:NumberInt("2021")},orderLine:[{isbn:"0006",price:NumberDecimal("341.0"),amount:NumberInt("2")},{isbn:"0007",price:NumberDecimal("170.5"),amount:NumberInt("1")}]}]}
Query
db.books.aggregate([{$lookup:{from:"orders",pipeline:[{$group:{_id:null,amount_total:{$sum:{$sum:"$orderLine.amount"}}}},{$project:{_id:0,amount_total:1}}],as:"amount"}},{$project:{_id:0,isbn:1,amount:1}}])