Since it is showing "No profile found", it means it going into catch error block, and error is originating where you are comparing rating.user.toString() and req.user.id, because you are not having null check on rating.user, instead use, this:
rating.user && rating.user.toString() === req.user.id