Database
[{"id":3853,"text":"Whats your age","answers":[],"parentid":1285,"tag":[]},{"id":4467,"text":"Whats your age","answers":[],"parentid":3853,"tag":[]},{"id":4498,"text":"Whats your age","answers":[],"parentid":3853,"tag":[]},{"id":4455,"text":"Whats your age","answers":[],"parentid":3854,"tag":[]},{"id":8754,"text":"Whats your age","answers":[],"parentid":3856,"tag":[]}]
Query
db.collection.aggregate([{"$match":{/** put your filtering criteria here*/"id":4467}},{"$graphLookup":{/** your sample data is suggesting recursive structure. Feel free to replace with plain $lookup*/"from":"collection","startWith":"$parentid","connectFromField":"parentid","connectToField":"id","as":"parent"}},{"$unwind":"$parent"},{"$replaceRoot":{"newRoot":"$parent"}},{$set:{tag:{"$setUnion":["$tag",["closed"]]}}},{"$merge":{/** use $merge to update back to the collection*/"into":"collection","on":"id"}}])