title: Connecting to MongoDB using Mongoose
body: <p>I'm trying to connect to my MongoDB on mLab using by </p>
  
  <pre><code>var mongoose = require('mongoose');
  var User = require('./modules/User');
  
  mongoose.connect('mongodb://&lt;dbuser&gt;:&lt;dbpassword&gt;@ds020168.mlab.com:20168/test_database');
  </code></pre>
  
  <p>I´ve stored this code in a file called test.js. Now, when I run the command</p>
  
  <pre><code>node test.js 
  </code></pre>
  
  <p>it outputs the following error message:</p>
  
  <pre><code>SyntaxError: Invalid or unexpected token
      at createScript (vm.js:80:10)
      at Object.runInThisContext (vm.js:139:10)
      at Module._compile (module.js:616:28)
      at Object.Module._extensions..js (module.js:663:10)
      at Module.load (module.js:565:32)
      at tryModuleLoad (module.js:505:12)
      at Function.Module._load (module.js:497:3)
      at Function.Module.runMain (module.js:693:10)
      at startup (bootstrap_node.js:191:16)
      at bootstrap_node.js:612:3
  </code></pre>
  
  <p>I haven't set up an Express application, my projects just comprises of this test.js file and a package.json file with the required dependecies added and installed. Additionally, I've created a User model that is also imported into test.js.</p>
  
  <p>Can someone explain to a beginner what else is required to successfully establish a connection and why the above code doesn't suffice? Besides, what does the error message tell me?</p>