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.

33 lines
926 B

  1. var mongoose = require('mongoose'),
  2. Schema = mongoose.Schema;
  3. var mongooseUniqueValidator = require('mongoose-unique-validator');
  4. var eventSchema = new Schema({
  5. title: { type: String, required: true },
  6. description: { type: String, required: true },
  7. img: { type: String },
  8. generateddate: { type: Date, required: true },
  9. date: { type: Date, required: true },
  10. categories: [{
  11. name: {type: String}
  12. }],
  13. location: {
  14. direction: { type: String },
  15. city: { type: String },
  16. district: { type: String },
  17. geo: {
  18. lat: {type: Number},
  19. long: {type: Number},
  20. name: { type: String}
  21. }
  22. },
  23. user: {
  24. type: mongoose.Schema.Types.ObjectId,
  25. ref: 'userModel'
  26. },
  27. type: {type: String}
  28. });
  29. eventSchema.plugin(mongooseUniqueValidator);
  30. module.exports = mongoose.model('eventModel', eventSchema);