How does the stomach protect us against bacteria?

the stomach is lined with a phlem like substance called mucus and it protects your stomach from bacteria and the acids inside your stomach from eating itself away.