Mongodb not creating database
<p>I cant create  my database 'sms-dev' in mongodb after starting the server but in my console it was printing connected to mongo successfully.I kept my db module inside models folder as db.js and export that module in another file(config.js) inside models folder</p>

<p>Here is the code in db.js file</p>

<pre><code> var db = {
   // Connects to mongoDB
   connect: function(url, options) {
   mongoose.connect(url, options);
   mongoose.connection.on('open', function(){
  console.log("Connected to mongo successfully");
  });

 mongoose.connection.on('disconnect', function(){
  console.log("Mongo disconnected");
});

mongoose.connection.on('error',function (err) {
  console.log('Mongoose default connection error: ' + err);
});

process.on('SIGINT', function() {
  mongoose.connection.close(function () {
    console.log('Mongoose default connection disconnected through app termination');
    process.exit(0);
  });
});

}
}

module.exports = db;
</code></pre>

<p>and my config.js file is</p>

<pre><code>exports.database = {
  url: 'mongodb://127.0.0.1:27017/sms-dev',
  options: {
    db: { native_parser: true,safe:true },
    server: { poolSize: 10 }
   }
   }
</code></pre>

<p>I connected this db in server.js as</p>

<pre><code>var dbcon = process.env.MONGOLAB_URI || config.database.url;
db.connect(dbcon, config.database.options);
</code></pre>