You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

50 lines
645 B

  1. 'use strict'
  2. /**
  3. * Entry schema
  4. *
  5. * @type {<Mongoose.Schema>}
  6. */
  7. var entrySchema = Mongoose.Schema({
  8. _id: String,
  9. title: {
  10. type: String,
  11. required: true,
  12. minlength: 2
  13. },
  14. subtitle: {
  15. type: String,
  16. default: ''
  17. },
  18. parent: {
  19. type: String,
  20. default: ''
  21. },
  22. content: {
  23. type: String,
  24. default: ''
  25. }
  26. },
  27. {
  28. timestamps: {}
  29. })
  30. entrySchema.index({
  31. _id: 'text',
  32. title: 'text',
  33. subtitle: 'text',
  34. content: 'text'
  35. }, {
  36. weights: {
  37. _id: 3,
  38. title: 10,
  39. subtitle: 5,
  40. content: 1
  41. },
  42. name: 'EntriesTextIndex'
  43. })
  44. module.exports = Mongoose.model('Entry', entrySchema)