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.

28 lines
753 B

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