Sunan an-Nasa'i, Book 1, Hadith 22 (Nasa'i 22)

It was narrated that Abu Ayyub Al-Ansari said:

"The Messenger of Allah (ﷺ) said: 'When any one of you goes to defecate, let him not face toward the Qiblah, rather let him face towards the east or the west.'"