breastfeeding and being pregnant

I'm breastfeeding my 2 year old and I'm pregnant again my doctor told me I should stop cuz most likely I'll have a miscarriage. so my question is can you have successful pregnancy and still breastfed your toddler with no problem