云数据库查询语句如下:
db.collection('users').aggregate()
.unwind('$contacts')
.match({
'contacts.location': _.geoNear({
geometry: db.Geo.Point(113.323809, 23.097732),
minDistance: 1000,
maxDistance: 5000,
}),
_id: '1234567'
})
.end()
报错 信息如下:
Error: FailedOperation, (BadValue) $geoNear, $near, and $nearSphere are not allowed in this context
geoNear
必须为第一个聚合阶段