From Sahih Muslim (Hadith 6371):
Ibn Umar reported:I used to spend nights in the mosque and by that time I had no wife and children. I saw in a dream as if I am being taken to a well. I made a mention of it to Allah's Messenger (may peacebe upon him). The rest of the hadith is the same
Reference: Muslim 6371