Files
talk/models/user.js
T
gaba c56eba1226 * Adds identifier and hide _id.
* Gets only the user for subdocuments and not the whole document.
2016-11-01 14:29:06 -07:00

24 lines
465 B
JavaScript

'use strict';
const mongoose = require('../mongoose');
const uuid = require('uuid');
const Schema = mongoose.Schema;
const UserSchema = new Schema({
id: {
type: String,
default: uuid.v4,
unique: true
},
name: String,
created_at: { type: Date, default: Date.now },
updated_at: { type: Date, default: Date.now }
},{
_id: false
});
const User = mongoose.model('User', UserSchema);
module.exports = User;
module.exports.Schema = UserSchema;