【发布时间】:2017-03-30 01:08:23
【问题描述】:
我将 MongoDB Geospatial 与 node.js 一起使用,并表示查询特定点附近最近的街道。 在我的结果中,我只想选择“名称”和“地址”字段。 我在下面尝试了这段代码,但它不起作用,我收到了这个错误:
“未处理的拒绝错误:不能将 $select 与 Array 一起使用。”
谢谢。
Street.find({
'location': {
$near: {
$geometry: {
type: 'Point',
coordinates: coords
},
$maxDistance: 1000
},
$select: {
_id: 0,
name: 1,
address: 1
}
}
})
【问题讨论】:
标签: node.js mongodb express geospatial