Answers for "mongoose find near location"

0

mongoose geojson

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 find near location

CityModel.find().where('location').near({center: coords, maxDistance: 500})
Posted by: Guest on August-23-2021
0

how to find geopoints radius in mongoose

var locQuery = (coords, distance) => {
    return { loc: { $near: { $geometry: { type: "Point", coordinates: coords }, $maxDistance: parseInt(distance)}}}
}
Posted by: Guest on October-16-2020

Code answers related to "Javascript"

Browse Popular Code Answers by Language