The Mosque in Madinah was not only a place of worship. The belivers assembled here to learn. When the Prophet (p.b.u.h.) was present, they heard his words of wisdom, his elucidation on the verses of Quran and benifitted by his counsel. And when he was not there, other faithful companions taught what they had heard from the Prophet of Allah
Once the Prophet (p.b.u.h.) entered the mosque before the prayer time and found two groups of people. One was busy in acts of worship while the other group in a corner was learning. They learnt how to read and write and discussed the teachings of Islam and their application to their daily lives.
Looking at both, the Prophet said: "They are both engaged in useful pursuits. But I am a teacher. I shall join the group assembled to learn.