review.js 749 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. const mongoose = require('mongoose');
  2. // Create the MovieSchema.
  3. var reviewSchema = new mongoose.Schema({
  4. userName: {
  5. type: String
  6. },
  7. date: {
  8. type: Date,
  9. required: true,
  10. default: Date.now
  11. },
  12. url: {
  13. type: String,
  14. required: true
  15. },
  16. score: {
  17. type: Number,
  18. required: true
  19. },
  20. title: {
  21. type: String
  22. },
  23. text: {
  24. type: String
  25. },
  26. sentiment: {
  27. type: mongoose.Schema.Types.Mixed
  28. },
  29. reviewId: {
  30. type: String,
  31. required: true,
  32. unique: true
  33. },
  34. app: { type: mongoose.Schema.Types.ObjectId, ref: 'app' }
  35. });
  36. // Export the model.
  37. module.exports = mongoose.model('review', reviewSchema);