Reputation: 49
I want to save circle just like we save polygons in mongodb using geospatial and get that circle when my lat, long exists in that circle.
Upvotes: 1
Views: 119
Reputation: 49
Below is the format in this way you can save the circle:
let mongoose = require('mongoose'); let Schema = mongoose.Schema; require('mongoose-double')(mongoose); let SchemaTypes = mongoose.Schema.Types; let deliveryZones= new Schema({ name:{type:String},//location name location: { 'type: {type: String,},//if want to save circle coordinates: type-circle coordinates: {type: Array} // centre coordinates of circle }, radius: {type:SchemaTypes.Double},// radius of circle })
Upvotes: 1