mongoose中的位置mongoDB

mongoose中的位置mongoDB,第1张

mongoose中的位置mongoDB

我自己修好了。

我在模型中这样做:

loc :  { type: {type:String}, coordinates: [Number]},

在下面,我将其设为2dsphere索引

eventSchema.index({loc: '2dsphere'});

并向其中添加数据:

loc: { type: "Point", coordinates: [ longitude, latitude ] },


欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/zaji/5642274.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-12-16
下一篇 2022-12-16

发表评论

登录后才能评论

评论列表(0条)

保存