Database

[{_id:"doc_123",parent_id:123,active:true,group:"A"},{id:"doc_123_1",parent_id:123,active:true},{id:"doc_123_2",parent_id:123,active:true}]

Query

db.collection.aggregate([{/** self-join matching on parent_id*/$lookup:{from:"collection",localField:"parent_id",foreignField:"parent_id","pipeline":[{"$match":{"group":"A"/** "A" is from the client*/}}],as:"parent"}},{$match:{active:true,/** "true" is from the client*/group:{$exists:false/** exclude parents*/}}}])

Result