process.env.PORT and process.env.IP are the port and IP address for your application, not your database. You will want to pull your Mongo connection string from your MongoDB provider.
The following is an example hello world with Node.js homepage , modified to use two environment variables.
var http = require('http'); http.createServer(function (req, res) { res.writeHead(200, {'Content-Type': 'text/plain'}); res.end('Hello World\n'); }).listen(process.env.PORT || 1337, process.env.IP || '127.0.0.1');
source share