BV and spotting. Has anyone had this?

Stephanie
I am six weeks and spotted brown for a week. The doctor told me I had a bacterial infection and gave me antibiotics. Has anyone had this experience? Did it go away and how did you prevent it?