Database

db={"users":[{_id:1,name:"John Doe",age:30},{_id:2,name:"Jane Doe",age:20}],"locations":[{_id:10,name:"Miami"},{_id:20,name:"Orlando"}],"contacts":[{_id:100,contacts:[{user_id:1,location_id:10,},{user_id:2,location_id:20,}]}]}

Query

db.contacts.aggregate([{"$unwind":"$contacts"},{"$lookup":{"from":"users","localField":"contacts.user_id","foreignField":"_id","as":"users"}},{"$lookup":{"from":"locations","localField":"contacts.location_id","foreignField":"_id","as":"locations"}},{"$set":{"users":{"$arrayElemAt":["$users",0]},"locations":{"$arrayElemAt":["$locations",0]}}},{"$project":{"contacts":{"user_id":1,"location_id":1,"user_name":"$users.name","user_age":"$users.age","location_name":"$locations.name"}}},{"$group":{"_id":"$_id","contacts":{"$push":"$contacts"}}}])

Result