gallery.js 513 B

1234567891011121314151617181920212223
  1. const mongoose = require("mongoose");
  2. const GallerySchema = new mongoose.Schema({
  3. owner: {
  4. type: mongoose.Schema.Types.ObjectId,
  5. ref: "Uploader",
  6. required: true
  7. },
  8. title: {
  9. type: String,
  10. required: true
  11. },
  12. tags: [String],
  13. images: [String],
  14. location: {
  15. type: {type: String},
  16. coordinates: [],
  17. required: false
  18. }
  19. });
  20. GallerySchema.index({location: "2dsphere"});
  21. module.exports = mongoose.model("Gallery", GallerySchema);