Sahih Muslim 524 a
Anas b. Malik reported:
The Messenger of Allah (ﷺ) came to Medina and stayed in the upper part of Medina for fourteen nights with a tribe called Banu 'Amr b 'Auf. He then sent for the chiefs of Banu al-Najir, and they came with swords around their inecks. He (the narrator) said: I perceive as if I am seeing the Messenger of Allah (ﷺ) on his ride with Abu Bakr behind him and the chiefs of Banu al-Najjar around him till he alighted in the courtyard of Abu Ayyub. He (the narrator) said: The Messenger of Allah (ﷺ) said prayer when the time came for prayer, and he prayed in the fold of goats and sheep. He then ordered mosques to be built and sent for the chiefs of Banu al-Najjar, and they came (to him). He (the Holy Prophet) said to them: O Banu al-Najjar, sell these lands of yours to me. They said: No, by Allah. we would not demand their price, but (reward) from the Lord. Anas said: There (in these lands) were trees and graves of the polytheists, and ruins. The Messenger of Allah (may peace he upon him) ordered that the trees should be cut, and the graves should be dug out, and the ruins should be levelled. The trees (were thus) placed in rows towards the qibla and the stones were set on both sides of the door, and (while building the mosque) they (the Companions) sang rajaz verses along with the Messenger of Allah (ﷺ): 
O Allah: there is no good but the good of the next world, So help the Ansar and the Muhajirin.
حَدَّثَنَا يَحْيَى بْنُ يَحْيَى، وَشَيْبَانُ بْنُ فَرُّوخَ، كِلاَهُمَا عَنْ عَبْدِ الْوَارِثِ، - قَالَ يَحْيَى أَخْبَرَنَا عَبْدُ الْوَارِثِ بْنُ سَعِيدٍ، عَنْ أَبِي التَّيَّاحِ الضُّبَعِيِّ، حَدَّثَنَا أَنَسُ بْنُ مَالِكٍ، أَنَّ رَسُولَ اللَّهِ صلى الله عليه وسلم قَدِمَ الْمَدِينَةَ فَنَزَلَ فِي عُلْوِ الْمَدِينَةِ فِي حَىٍّ يُقَالُ لَهُمْ بَنُو عَمْرِو بْنِ عَوْفٍ ‏.‏ فَأَقَامَ فِيهِمْ أَرْبَعَ عَشْرَةَ لَيْلَةً ثُمَّ إِنَّهُ أَرْسَلَ إِلَى مَلإِ بَنِي النَّجَّارِ فَجَاءُوا مُتَقَلِّدِينَ بِسُيُوفِهِمْ - قَالَ - فَكَأَنِّي أَنْظُرُ إِلَى رَسُولِ اللَّهِ صلى الله عليه وسلم عَلَى رَاحِلَتِهِ وَأَبُو بَكْرٍ رِدْفُهُ وَمَلأُ بَنِي النَّجَّارِ حَوْلَهُ حَتَّى أَلْقَى بِفِنَاءِ أَبِي أَيُّوبَ - قَالَ - فَكَانَ رَسُولُ اللَّهِ صلى الله عليه وسلم يُصَلِّي حَيْثُ أَدْرَكَتْهُ الصَّلاَةُ وَيُصَلِّي فِي مَرَابِضِ الْغَنَمِ ثُمَّ إِنَّهُ أَمَرَ بِالْمَسْجِدِ قَالَ فَأَرْسَلَ إِلَى مَلإِ بَنِي النَّجَّارِ فَجَاءُوا فَقَالَ ‏
"‏ يَا بَنِي النَّجَّارِ ثَامِنُونِي بِحَائِطِكُمْ هَذَا ‏"‏ ‏.‏ قَالُوا لاَ وَاللَّهِ لاَ نَطْلُبُ ثَمَنَهُ إِلاَّ إِلَى اللَّهِ ‏.‏ قَالَ أَنَسٌ فَكَانَ فِيهِ مَا أَقُولُ كَانَ فِيهِ نَخْلٌ وَقُبُورُ الْمُشْرِكِينَ وَخِرَبٌ ‏.‏ فَأَمَرَ رَسُولُ اللَّهِ صلى الله عليه وسلم بِالنَّخْلِ فَقُطِعَ وَبِقُبُورِ الْمُشْرِكِينَ فَنُبِشَتْ وَبِالْخِرَبِ فُسُوِّيَتْ - قَالَ - فَصَفُّوا النَّخْلَ قِبْلَةً وَجَعَلُوا عِضَادَتَيْهِ حِجَارَةً - قَالَ - فَكَانُوا يَرْتَجِزُونَ وَرَسُولُ اللَّهِ صلى الله عليه وسلم مَعَهُمْ وَهُمْ يَقُولُونَ اللَّهُمَّ إِنَّهُ لاَ خَيْرَ إِلاَّ خَيْرُ الآخِرَهْ فَانْصُرِ الأَنْصَارَ وَالْمُهَاجِرَهْ