Database
[{/**"_id": ObjectId(),*/"number":"ABC-123456","status":"new","items":[{/**"_id": ObjectId(),*/"name":"invoice","people":[{"first_name":"John","last_name":"Doe","active":false},{"first_name":"Jane","last_name":"Smith","active":true},{"first_name":"Fred","last_name":"Bloggs","active":true}]},{/**"_id": ObjectId(),*/"name":"unimportant_document","people":[{"first_name":"John","last_name":"Doe","active":true}]},{/**"_id": ObjectId(),*/"name":"order","people":[{"first_name":"Fred","last_name":"Bloggs","active":true}]}]}]
Query
db.collection.aggregate([{$set:{"invoice_persons":{$first:{$filter:{input:"$items",cond:{$eq:["$$this.name","invoice"]}}}},"order_persons":{$first:{$filter:{input:"$items",cond:{$eq:["$$this.name","order"]}}}}}},{$set:{"invoice_person_full_name":{$first:{$map:{input:{$filter:{input:"$invoice_persons.people",cond:{$eq:["$$this.active",true]}}},in:{"$concat":["$$this.first_name"," ","$$this.last_name"]}}}},"order_person_full_name":{$first:{$map:{input:{$filter:{input:"$order_persons.people",cond:{$eq:["$$this.active",true]}}},in:{"$concat":["$$this.first_name"," ","$$this.last_name"]}}}}}},{"$unset":["invoice_persons","order_persons","items"]}])