Check readyState before attempting to connect mongoose

Avoids conflict if parent app has already connected