title: Node.js get request from MongoDB returning undefined
body: <p>I'm trying to build a small web app as I try to learn MEAN stack web development.</p>
  
  <p>I have a running MongoDB with a collection named 'contactlist', this list will then be accessed by a <code>Node.js/Express.js</code> server to retrieve the information into a JSON object and pass it through an angular controller.</p>
  
  <pre><code>var express = require('express');
  var mongojs = require('mongojs');
  var db = mongojs('contactlist', ['contactlist']);
  var app = express();
  const port = 80;
  
  app.use(express.static(__dirname + "/public"));
  app.get('/contactlist', function(req, res){
      console.log("I received a GET request")
      db.contactlist.find(function(err, docs){
          console.log("Getting data from db");
          console.log(docs);
          res.json(docs);
      });
      console.log("Returned data");
  });
  
  app.listen(port,'0.0.0.0');
  console.log('Server running on port '+port);
  </code></pre>
  
  <p>Included code for controller</p>
  
  <pre><code>var myApp = angular.module('myApp',[]);
  
  myApp.controller('AppCtrl',['$scope','$http',function ($scope,$http){
      console.log("Hello World")
      console.log("Getting data from server")
      $http.get('/contactList').success(function(response){
          console.log("I got the data I requested");
          $scope.contactList = response;
      })
  }]);
  </code></pre>
  
  <p>log from the server:</p>
  
  <pre><code>C:\Users\savila\Documents\Code\contactListApp&gt;node server
  Server running on port 80
  I received a GET request
  Returned data
  Getting data from db
  undefined
  </code></pre>