Database
db={"users":[{_id:ObjectId("61a6d586e56ea12d6b63b68e"),fullName:"Mr A"},{_id:ObjectId("6231a89b009d3a86c788bf39"),fullName:"Mr B"},{_id:ObjectId("6231a89b009d3a86c788bf3a"),fullName:"Mr C"}],"complains":[{_id:ObjectId("6231aaba2a038b39d992099a"),type:"fee",postedBy:ObjectId("61a6d586e56ea12d6b63b68e")},{_id:ObjectId("6231aaba2a038b39d992099b"),type:"fee",postedBy:ObjectId("6231a89b009d3a86c788bf3c")},{_id:ObjectId("6231aaba2a038b39d992099c"),type:"fee",postedBy:ObjectId("6231a89b009d3a86c788bf3b")},]}
Query
db.complains.aggregate([{"$lookup":{from:"users",localField:"postedBy",foreignField:"_id",as:"postedByLookup"}},{$match:{postedByLookup:[]}},{"$addFields":{"type":"other"}},{"$project":{postedByLookup:false}},{"$merge":{"into":"complains","on":"_id","whenMatched":"replace"}}])