coding API and mongo connection