Преглед на файлове

Add location to gallery model.
Index the location propery on gallery model.

Lee Morgan преди 5 години
родител
ревизия
139d6cdc66
променени са 1 файла, в които са добавени 7 реда и са изтрити 1 реда
  1. 7 1
      models/gallery.js

+ 7 - 1
models/gallery.js

@@ -11,7 +11,13 @@ const GallerySchema = new mongoose.Schema({
         required: true
     },
     tags: [String],
-    images: [String]
+    images: [String],
+    location: {
+        type: {type: String},
+        coordinates: [],
+        required: false
+    }
 });
+GallerySchema.index({location: "2dsphere"});
 
 module.exports = mongoose.model("Gallery", GallerySchema);