我自己修好了。
我在模型中这样做:
loc : { type: {type:String}, coordinates: [Number]},在下面,我将其设为2dsphere索引。
eventSchema.index({loc: '2dsphere'});并向其中添加数据:
loc: { type: "Point", coordinates: [ longitude, latitude ] },
我自己修好了。
我在模型中这样做:
loc : { type: {type:String}, coordinates: [Number]},在下面,我将其设为2dsphere索引。
eventSchema.index({loc: '2dsphere'});并向其中添加数据:
loc: { type: "Point", coordinates: [ longitude, latitude ] },