Database

db={"suspects":[{"_id":ObjectId("64f8d65249432809cdc3cb37"),"fullName":"John Doe -1","phoneNumber":"XXXXXXXXX","totalCriminalRecord":3},{"_id":ObjectId("64f8d6cd49432809cdc3cb38"),"fullName":"John Doe -2","phoneNumber":"XXXXXXXXX","totalCriminalRecord":5}],"lawyers":[{"_id":ObjectId("64f8d58849432809cdc3cb34"),"fullName":"John Doe -3","phoneNumber":"XXXXXXXXX","workAddress":"Address of .."},{"_id":ObjectId("64f8d5f349432809cdc3cb35"),"fullName":"John Doe -4","phoneNumber":"XXXXXXXXX","workAddress":"Address of .."}],"cases":[{"_id":ObjectId("64f8d9f549432809cdc3cb3d"),"crimeNumber":12345,"eventDate":"01/01/2023","suspects":[{"id":ObjectId("64f8d65249432809cdc3cb37"),"note":"-- additional note --","lawyer":{"id":ObjectId("64f8d58849432809cdc3cb34"),"note":"--additional note --"}},{"id":ObjectId("64f8d6cd49432809cdc3cb38"),"note":"-- additional note --","lawyer":{"id":ObjectId("64f8d58849432809cdc3cb34"),"note":"--additional note --"}}]}]}

Query

db.cases.aggregate([{"$lookup":{"from":"suspects","localField":"suspects.id","foreignField":"_id","as":"_tmp.suspects"}},{"$lookup":{"from":"lawyers","localField":"suspects.lawyer.id","foreignField":"_id","as":"_tmp.lawyers"}},{"$set":{"suspects":{"$map":{"input":"$suspects","as":"suspect","in":{"$mergeObjects":["$$suspect",{"$reduce":{"input":"$_tmp.suspects","initialValue":null,"in":{"$cond":[{"$eq":["$$suspect.id","$$this._id"]},"$$this","$$value"]}}}]}}}}}])

Result