title: "waiting for connections on port 27017" connecting to mongoose
body: <p>I"m getting this message when I run mongod. </p>
  
  <p>In the tutorial I'm doing, I think I should be getting something like "connection accepted from 127.0.0.16:6.."</p>
  
  <p>I checked out this post already - <a href="https://stackoverflow.com/questions/35818009/mongod-hostnamecanonicalizationworker-error-on-os-x">mongod HostnameCanonicalizationWorker error on OS X</a></p>
  
  <p>and I have my hosts file set up as such: </p>
  
  <pre><code>127.0.0.1       localhost
  127.0.0.1 Bens-MacBook-Pro.local
  255.255.255.255 broadcasthost
  ::1             localhost
  </code></pre>
  
  <p>These are my scripts for Node: </p>
  
  <pre><code>// Main starting point of the application
  const express = require('express');
  const http = require('http');
  const bodyParser = require('body-parser');
  const app = express();
  const morgan = require('morgan');
  const router = require('./router');
  const mongoose = require('mongoose');
  
  // DB Setup
  
  mongoose.connect('mongodb://localhost:auth/auth');
  
  
  // App Setup
  app.use(morgan('combined'));
  app.use(bodyParser.json({type: '*/*' }));
  router(app);
  
  // Server Setup
  const port = process.env.PORT || 3090;
  const server = http.createServer(app);
  server.listen(port);
  
  console.log('Server listening on:', port);
  </code></pre>
  
  <p>This is the log for mongod:</p>
  
  <pre><code>2016-11-20T16:33:13.095-0700 I CONTROL  [initandlisten] MongoDB starting : pid=15054 port=27017 dbpath=/data/db 64-bit host=Bens-MacBook-Pro.local
  </code></pre>
  
  <p>......</p>
  
  <pre><code>2016-11-20T16:33:13.380-0700 I NETWORK  [initandlisten] waiting for connections on port 27017
  </code></pre>
  
  <p>What is missing? </p>
  
  <p>Thanks!</p>
  
  <p><strong><em>UPDATED</em></strong></p>
  
  <p><a href="http://code.runnable.com/UWxv-JS8trEHAACH/connect-to-mongodb-using-mongoosejs-for-node-js" rel="nofollow noreferrer">http://code.runnable.com/UWxv-JS8trEHAACH/connect-to-mongodb-using-mongoosejs-for-node-js</a></p>
  
  <p>I added a listener to check for connection: </p>
  
  <pre><code>/*
  * More details here http://mongoosejs.com/docs/index.html
  */
  
  //require mongoose node module
  var mongoose = require('mongoose');
  
  //connect to local mongodb database
  var db = mongoose.connect('mongodb://127.0.0.1:27017/test');
  
  //attach lister to connected event
  mongoose.connection.once('connected', function() {
      console.log("Connected to database")
  });
  </code></pre>
  
  <p>And it is logging "Connected to database" so it <em>appears</em> to be connected even thought the mongod window says it's not. Let me go through the rest of the tutorial and see if it's truly connected. </p>