Message.js 324 B

12345678910
  1. const {model, Schema} = require('mongoose');
  2. const Message = new Schema({
  3. text: {type: String, required: true},
  4. userName : {type: String, required: true},
  5. createDate: {type: Date, required: true},
  6. user: { type: Schema.Types.ObjectId, ref: 'User' } //not using
  7. })
  8. module.exports = model('Message', Message)