Abu Salama reported:
I used to see (such horrible dreams) that I fell ill. I saw Abu Qatada who also said: I used to see dreams which made me sick until I heard Allah's Messenger (ﷺ) as saying: Good dreams are from Allah, so if any one of you sees which he likes he should not disclose it to one but whom he loves, but if he sees something which he does not like he should spit on his left side thrice and seek refuge with Allah from the mischief of the Satan and its mischief (i.e. of the dream), and he should not relate it to anyone, then it would not harm him.
Reference: Sahih Muslim 2261 g
In-book reference: Book 42, Hadith 7
USC-MSA web (English) reference(deprecated numbering scheme): Book 29, Hadith 5619