db.tablebusiness.find({ "LongitudeLatitude" : { "$nearSphere" : [106.772835, -6.186753], "$maxDistance" : 0.053980478460939611 }, "Prominent" : { "$gte" : 15 }, "indexContents" : { "$all" : [/^soto/, /^nasi/] } }).limit(200).explain();
{
"cursor" : "GeoSearchCursor",
"nscanned" : 48,
**"nscannedObjects" : 48,**
"n" : 48,
"millis" : 8563,
"nYields" : 0,
"nChunkSkips" : 0,
"isMultiKey" : false,
"indexOnly" : false,
"indexBounds" : {
}
}
>
那么索引的名称是什么?我看到一些问题,其中索引名称确实出现了。看看这里 MongoDB:为什么按多个键排序不使用索引?例如
我也听说过解释(真实(在某处根本没有记录在这里:
http://www.mongodb.org/display/DOCS/Explain
我不确定这是故意的还是有缺陷的,但是当使用地理空间索引时,所用索引的名称不会显示在解释计划中。
只有在使用 BtreeCursor 时,才会显示索引名称。
如上面的注释中所述,一个集合上只能有一个地理空间索引。在此参数下,您可以假定如果光标是"GeoSearchCursor",则它正在使用此集合所需的索引。
这是一个已知问题。请参阅 https://jira.mongodb.org/browse/SERVER-4213