Our complete code
Now that we have defined our schemas and compiled the models, let's take a look at our /model/db.js
file.
var mongoose = require( 'mongoose' ), dbURI = 'mongodb://localhost/MongoosePM'; mongoose.connect(dbURI); // Connection events snipped out for brevity /* ******************************************** USER SCHEMA ******************************************** */ var userSchema = new mongoose.Schema({ name: String, email: {type: String, unique:true}, createdOn: { type: Date, default: Date.now }, modifiedOn: Date, lastLogin: Date }); // Build the User model mongoose.model( 'User', userSchema ); /* ******************************************** PROJECT SCHEMA ******************************************** */ var projectSchema = new mongoose.Schema({ projectName: String, createdOn: { type: Date, default: Date.now }, modifiedOn: Date, createdBy: String, contributors: String, tasks: String }); // Build the Project model mongoose.model( 'Project...