NewsItem.js 386B

12345678910111213141516171819202122
  1. /* Model for a News item in the DB */
  2. var mongoose = require('mongoose');
  3. var Schema = mongoose.Schema;
  4. var NewsItemSchema = new Schema(
  5. {
  6. title: String,
  7. contents: String,
  8. date: {
  9. type: Date,
  10. default: Date.now
  11. }
  12. },
  13. {
  14. collection: 'news'
  15. }
  16. );
  17. module.exports = mongoose.model('NewsItem', NewsItemSchema);