Refactor db.js to use environment variables for mongo connection