Database

[{"_id":1,"forms":[{"current_version":0,"history":[{"content":[{"label":"vrau"}],"responses":[{"client_id":1,"response":[{"field":"vrau1"}]},{"client_id":1,"response":[{"field":"vrau1"}]},{"client_id":2,"response":[{"field":"vrau2"}]},{"client_id":2,"response":[{"field":"vrau2"}]},],}],}],"name":"Testing",},{"_id":2,"forms":[{"current_version":1,"history":[{"content":[{"label":"vrau"}],"responses":[{"client_id":1,"response":[{"field":"vrau11"}]},{"client_id":1,"response":[{"field":"vrau11"}]},{"client_id":2,"response":[{"field":"vrau22"}]},{"client_id":2,"response":[{"field":"vrau22"}]},],}],}],"name":"Testing2",},]

Query

db.collection.aggregate([{$match:{_id:1}},{$project:{responses:{$reduce:{input:"$forms",initialValue:[],in:{$concatArrays:[{$reduce:{input:"$$this.history",initialValue:[],in:{$concatArrays:["$$value","$$this.responses"]}}},"$$value"]}}}}},{$project:{responses:{$filter:{input:"$responses",as:"item",cond:{$eq:["$$item.client_id",1]}}}}}])

Result