Advertisement
Guest User

Untitled

a guest
Aug 30th, 2015
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.94 KB | None | 0 0
  1. var mongoose = require('mongoose');
  2. var Schema = mongoose.Schema;
  3. var ObjectId = mongoose.Schema.Types.ObjectId;
  4.  
  5. var answerSchema = new Schema({
  6. description: {type: String, required: true},
  7. fileId: String,
  8. fileName: String,
  9. author: {
  10. email: String,
  11. label: String,
  12. username: String
  13. },
  14. created: {type: Date, 'default': Date.now}
  15. });
  16.  
  17. var schema = new Schema({
  18. question: {type: String, required: true},
  19. author: {
  20. label: String,
  21. username: String,
  22. points: Number,
  23. tags: Array,
  24. job: String,
  25. description: String,
  26. avatar: String
  27. },
  28. authorId: {type: Schema.Types.ObjectId, ref: 'accounts'},
  29. votes: [{type: Schema.Types.ObjectId, ref: 'accounts'}],
  30. tags: Array,
  31. labels: Array,
  32. fileId: String,
  33. created: {type: Date, 'default': Date.now},
  34. lastActivity: {type: Date, 'default': Date.now},
  35. answers: [answerSchema]
  36. });
  37.  
  38. var Question = mongoose.model('question', schema);
  39.  
  40. module.exports = Question;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement