Anas (May Allah be pleased with him) said:
The Messenger of Allah (ﷺ) said, "It is not proper to use the mosque for urinating or easing oneself. They are merely built for the remembrance of Allah and the recitation of the Qur'an", or as he stated.[Muslim].
App reference: Book 18, Hadith 185
Arabic/English book reference: Book 18, Hadith 1695