Database

db={"workHistory":[{"_id":2003,"history":[{"_id":"600331b3d84ac418877a0e5a","tasksPerformed":["5fffb180a477c4f78ad67331","5fffb18aa477c4f78ad67332"],"year":2003},{"_id":"600331dcd84ac418877a0e5c","tasksPerformed":["5fffb180a477c4f78ad67331"],"year":2003}]}],"taskSchema":[{"_id":"5fffb180a477c4f78ad67331","active":true,"title":"first"},{"_id":"5fffb18aa477c4f78ad67332","active":true,"title":"second"}]}

Query

db.workHistory.aggregate([{"$unwind":"$history"},{"$lookup":{"from":"taskSchema","localField":"history.tasksPerformed","foreignField":"_id","as":"history.tasksPerformed"}},{"$group":{"_id":"$_id","history":{"$push":"$history"}}}])

Result