added curl_mongo and err handler for mongo rest api