我一直在看这段代码已经有一段时间了,不能为我的生活找到错误。任何帮助深表感谢。这是代码:
Item.aggregate(
[
{ "$match": { "$text": { "$search": query} } },
{ "$geoNear": {
"near": {
"type": "Point",
"coordinates": [parseFloat(lon),parseFloat(lat)]
},
"distanceField": "distance",
"spherical": true,
"maxDistance": 33000
}},
{"score":{"$meta": "textScore"}},
{ "$sort": { "distance": 1, "score": { "$meta": "textScore" } } },
{"$limit": 20}
], callback);