Abu Saeed Khudri reported,

The Messenger of Allah ﷺ passed by an onion field along with his companions. Some of them dismounted and ate from it, while others did not. We then went to him, and he called forward those who had not eaten the onions and kept the others back until the smell had gone.

Azami 3149

Sahih

عن أبي سعيد الخدري

أن رسول الله ﷺ مر على زراعة بصل هو وأصحابه، فنزل ناس منهم فأكلوا منه، ولم يأكل آخرون، فرحنا إليه، فدعا الذين لم يأكلوا البصل، وأخر الآخرين حتى ذهب ريحها.

الأعظمي 3149صحيح
Contents
Reference
Commentary
Ayat
Collection
Jami al-Kamil
Book
Mosques
Section
Prohibition of coming to the mosques after eating garlic, onions, and leeks
Numbering
Jami al-Kamil 3149 (2nd edition)
Azami 3149