运行如下程序时:
db.collection('restaurant')
.where({
location: db.command.geoNear({
geometry: db.Geo.Point(101.724945068359, 36.634250640869),
minDistance: 0,
maxDistance: 1000,
})
})
.get()
在云开发的控制面板中,高级操作中的模板中,运行该代码,可查询到数据。
但在编译小程序后运行时,出现如下现象:
VM524:1 thirdScriptError
db.command.geoNear is not a function;at pages/restaurant/index/index page loadRestaurant function
TypeError: db.command.geoNear is not a function
at t.loadRestaurant (http://127.0.0.1:35056/appservice/pages/restaurant/index/index.js:172:35)
at t.
at t.setForm (http://127.0.0.1:35056/appservice/pages/restaurant/index/index.js:131:10)
at t.
at t.l (http://127.0.0.1:35056/appservice/__dev__/WAService.js:18:23682)
at cn (http://127.0.0.1:35056/appservice/__dev__/WAService.js:19:26271)
at Function.
at http://127.0.0.1:35056/appservice/__dev__/WAService.js:18:26416
at http://127.0.0.1:35056/appservice/__dev__/WAService.js:10:16499
at n (http://127.0.0.1:35056/appservice/__dev__/WAService.js:6:7842)
求解?
基础库版本是否太低
缺少这俩句constdbwxclouddatabase()
constdbcommand
开发工具中,console.log(db),command中就是没有该方法呀。
怎么办?