1
解釋我試圖讓上我總有關MongoDB 3.2.5做的,以利用{explain:true}
查看信息如果使用我的指標:的MongoDB:嘗試獲得對聚集
db.mycollection.aggregate([{
"$geoNear": {
"near": {
type: "Point",
coordinates: [2.48043, 49.14128]
},
"spherical": true,
"distanceField": "distance",
"maxDistance": 500
}
}, {
"$match": {
"date": {
$gt: new ISODate("2016-01-01T01:01:01Z")
}
}
}, {
"$sort": {
"score": -1,
"distance": 1
}
}], {
explain: true
});
結果我只得到了各階段彙總:
{
"waitedMS": NumberLong(0),
"stages": [{
"$geoNear": {
"near": {
"type": "Point",
"coordinates": [
2.48043,
49.14128
]
},
"distanceField": "distance",
"limit": NumberLong(100),
"maxDistance": 500,
"query": {
},
"spherical": true,
"distanceMultiplier": 1
}
}, {
"$match": {
"date": {
"$gt": ISODate("2016-01-01T01:01:01Z")
}
}
}, {
"$sort": {
"sortKey": {
"score": -1,
"distance": 1
}
}
}],
"ok": 1
}
我沒有對文檔進行掃描,使用索引等任何信息......
有人可以幫助我,好嗎?
如果我遵循手冊,$ geoNear必須是合成管道中的第一個階段......不是? –
好@CedricLecocq這可能是爲什麼索引不包括在解釋條目(和事件,他們無法使用) – profesor79
我試圖交換$ geoNear和$匹配,但我得到了一個錯誤,因爲我的預期... 如果我刪除了$ geoNear舞臺,在我正在尋找的信息類型的解釋中,我獲得了一個$ cursor遊標階段... –