pablocattaneo
1/24/2017 - 11:54 PM

/* This file sets the Schema and a Collection */

/* This file sets the Schema and a Collection */

/* This file sets the Schema and a Collection  */

const mongoose = require('mongoose');
const Schema = mongoose.Schema; /* Schema define what property must to have every record in the collection and what type of data it has to be  */

const UserSchema = new Schema({ /* Define Schema */
    name: String
})

const Use = mongoose.model('user', UserSchema); /* The first parameter checks if the db has a collection called user, if not it creates one. The model methods return the entire collection user */

module.exports = User; /* Exports the user collection so another file can use it */