Database

db={"a":[{"id":1,"price":"1200","name":"x1"},{"id":2,"price":"2000","name":"x2"},{"id":3,"price":"3000","name":"x3"}],"b":[{"id":1,"price":"1500","name":"x1"},{"id":2,"price":"2500","name":"x2"},{"id":3,"price":"3125","name":"x3"},],"c":[{"id":1,"data":{"detail":{"price":1900}},"name":"x1"},{"id":2,"data":{"detail":{"price":2900}},"name":"x2"},{"id":3,"data":{"detail":{"price":3500}},"name":"x3"}]}

Query

db.a.aggregate([{"$lookup":{"from":"b","localField":"name","foreignField":"name","as":"b"}},{"$lookup":{"from":"c","localField":"name","foreignField":"name","as":"c"}},{"$unwind":"$b"},{"$unwind":"$c"},{"$set":{"b.price":{"$toInt":"$b.price"},"price":{"$toInt":"$price"}}},{"$group":{"_id":"$_id","name":{"$first":"$name"},"id":{"$first":"$id"},"priceA":{"$push":"$price"},"priceB":{"$push":"$b.price"},"priceC":{"$push":"$c.data.detail.price"}}},{"$set":{"price":{"$concatArrays":["$priceA","$priceB","$priceC"]}}},{"$project":{"_id":0,"id":1,"name":1,"price":{"$avg":"$price"}}}])

Result