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([{$match:{/** set this to a variable for true/false search*/active:true,/** set this to a variable for group search* only "parents" have the group*/group:"A"}},{/** self-lookup into the same collection, matching on parent_id*/$lookup:{from:"collection",localField:"parent_id",foreignField:"parent_id",as:"children"}},{$unwind:"$children"},{$replaceWith:"$children"},{/** exclude the parents* IF YOU ALSO WANT PARENTS THEN REMOVE THIS STAGE*/$match:{group:{$exists:false}}}])

Result