为什么要进行聚合
aggregate.near({
near: coord,
distanceField: "distance",
maxDistance: max
});
可以返回
{
"name": "MongoError",
"errmsg": "exception: geoNear command failed: { ok: 0.0, errmsg: \"more than one 2d index, not sure which to run geoNear on\" }",
"code": 16604,
"ok": 0
}
在这个方案中,只有一个二维索引:
location: { type: [ Number ], index: '2d', sparse: true },
当我从方案中删除 EVERYTHING 时,错误没有改变。
为什么?哦,为什么...