It is narrated from Sayyiduna Anas bin Malik (may Allah be pleased with him) that the Prophet (peace and blessings be upon him) saw mucus (phlegm) on the qiblah side of the mosque, and his radiant face turned red (out of displeasure). Then a woman of the Ansar came, scraped it clean, and applied khaluq (a compound perfume) in its place. The Messenger of Allah (peace and blessings be upon him) said: "How fine a deed this is!"
Imam Ibn Khuzaymah (may Allah have mercy on him) narrated it like this in his Sahih.
Imam al-Athram (may Allah have mercy on him) said: "I heard Imam Abu Abdullah (Ahmad bin Hanbal) (may Allah have mercy on him) mention A'idh bin Habib (may Allah have mercy on him), and he praised him highly."
Imam Ibn Majah (may Allah have mercy on him) narrated it in his Sunan through Muhammad bin Tarif (may Allah have mercy on him), from A'idh bin Habib (may Allah have mercy on him).
Related hadith on this topic
Explanation & Benefits
Shaykh Muhammad Farooq Rafi
Benefits:
➊ There is a command to keep the mosques clean and pure and perfumed with fragrance and the like.
Through this the worshippers remain happy and cheerful, delight arises in their natures, and people perform worship with concentration.
➋ Spitting, throwing mucus and scattering filth in the mosques is a sin, and where mucus or impurity is stuck, cleaning that part and applying fragrance there is a recommended act.
In the previous hadith it is stated that the Noble Prophet sallallahu alayhi wa sallam cleaned the filth with his own hand, whereas in this hadith it is stated that an Ansari woman cleaned this filth.
From this it is known that these are two different incidents.
Therefore these two ahadith do not contradict one another.
Source: Sahih Ibn Khuzaymah: Commentary by Muhammad Farooq Rafee, Page: 1296