我想保存圆,就像我们使用地理空间在mongodb中保存多边形一样,当我的纬度存在于那个圆圈中时,得到那个圆圈。
答案 0 :(得分:1)
以下是您可以保存圆圈的格式:
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 })