check mongoose connection before connect