Sahih Muslim | Book 29 | Hadith Number 5649
Narrated by Abu Musa
Abu Musa reported Allah's Messenger (may peace be upon him) as saying: I saw in sleep that I was about to migrate from Mecca to a land abounding in palm-trees and I guessed that it would be Yamama or Hajar, but it was the city of Yathrib (the old name of Medina), and I saw in this dream of mine that I was brandishing a sword and its upper end was broken and this is what fell (in the form of misfortune to the believers on the Day of Ubud). I brandished (the sword) for the second time and it became all right and this is what came to be true when Allah granted us victory and solidarity of the believers. And I saw therein cows also and Allah is the Doer of good. These meant the group from amongst the believers on the Day of Ubud and the goodness which Allah brought after that and the reward of attestation of his Truth which Allah brought to us after the Day of Badr.