Comment.js 537 B

1234567891011121314151617181920212223
  1. var mongoose = require('mongoose');
  2. var schemaOptions = {
  3. timestamps: true,
  4. toJSON: {
  5. virtuals: true
  6. }
  7. };
  8. var commentSchema = new mongoose.Schema({
  9. attachedToUser: { type : mongoose.Schema.ObjectId, ref : 'User' },
  10. attachedToWatch: { type : mongoose.Schema.ObjectId, ref : 'Watch' },
  11. creator: { type : mongoose.Schema.ObjectId, ref : 'User' },
  12. date: Date,
  13. type: String, //public, admin, deleted
  14. body: String,
  15. }, schemaOptions);
  16. var Comment = mongoose.model('Comment', commentSchema);
  17. module.exports = Comment;