Try for a while to connect to MongoDB (useful for machine startup)