title: Mongoose: Create a User schema and Todo schema
body: <p>Good afternoon guys. I've been working on building a little contact list app and I wanted to use mongoose for storing data and session items. I've never used mongoose before so I picked up a quick PDF to follow along with. Most of if makes sense and I was able to piece some stuff together and get authentication running to add new users using a <code>UserSchema</code>. Works great. What I'm a little lost on now is how can I use mongoose to create a second schema called <code>ContactSchema</code>. I thought I would create 2 different files for each schema (user.js and contact.js), but when I try that, I still don't see a contact collection when I run <code>show collections</code> in my mongo terminal and I also don't throw any errors. It's also the same when I check for it in robomongo. </p>
  
  <p>My server file calls the all my models like this:</p>
  
  <pre><code>require('./server/models').connect(config.dbUri);
  // config.dbUri -&gt; "dbUri": "mongodb://localhost/react_app"
  </code></pre>
  
  <p>My user.js file:</p>
  
  <pre><code>const mongoose = require('mongoose');
  const bcrypt = require('bcrypt');
  
  // define the User model schema
  const UserSchema = new mongoose.Schema({
    email: {
      type: String,
      index: { unique: true }
    },
    password: String,
    name: String
  });
  
  ...bcrypt code here
  
  module.exports = mongoose.model('User', UserSchema);
  </code></pre>
  
  <p>My contact.js file:</p>
  
  <pre><code>const mongoose = require('mongoose');
  
  // define the Contact model schema
  const ContactSchema = new mongoose.Schema({
    content    : String,
    updated_at : Date
  });
  
  module.exports = mongoose.model('Todo', ContactSchema);
  </code></pre>
  
  <p>My index.js file to require both user.js and contact.js schemas:</p>
  
  <pre><code>const mongoose = require('mongoose');
  
  module.exports.connect = (uri) =&gt; {
    mongoose.connect(uri);
  
    // plug in the promise library
    mongoose.Promise = global.Promise;
  
    mongoose.connection.on('error', (err) =&gt; {
      console.error(`Mongoose connection error: ${err}`);
      process.exit(1);
    });
  
    require('./user');
    require('./contact');
  };
  </code></pre>
  
  <p>The index.js, user.js and contact.js files are all inside of my models folder. I can get this to run with no errors in console, but I'm still not seeing the contact collection on the mongo side. Am I on the right track here? As always any help or related posts are greatly appreciated. To get a better idea, here is the github link to the full project: <a href="https://github.com/DanDeller/Base" rel="nofollow noreferrer">https://github.com/DanDeller/Base</a>. Thanks again guys.</p>