Answers for "mongoose geospatial Schema Options"

0

mongoose geospatial Schema Options

const citySchema = new mongoose.Schema({
  name: String,
  location: {
    type: {
      type: String, // Don't do `{ location: { type: String } }`
      enum: ['Point'], // 'location.type' must be 'Point'
      required: true
    },
    coordinates: {
      type: [Number],
      required: true
    }
  }
});
Posted by: Guest on May-23-2020
0

mongoose geospatial Schema Options

{
  "type" : "Point",
  "coordinates" : [
    -122.5,
    37.7
  ]
}
Posted by: Guest on June-25-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language