Database

db={"users":[{"username":"John"},{"username":"Doe"}],"messages":[{"title":"Lorem Ipsum!","views":400,"author":"John"},{"title":"Lorem Ipsum!","views":200,"author":"John"},{"title":"Lorem Ipsum!","views":100,"author":"John"},{"title":"Lorem Ipsum!","views":403,"author":"Doe"},{"title":"Lorem Ipsum!","views":299,"author":"Doe"}]}

Query

db.users.aggregate([{"$lookup":{"from":"messages","let":{"username":"$username"},"pipeline":[{"$match":{"$expr":{"$eq":["$$username","$author"]}}},{"$group":{"_id":null,"highest_views":{"$max":"$views"}}}],"as":"highest_views"}},{"$set":{"highest_views":{"$arrayElemAt":["$highest_views.highest_views",0]}}}])

Result