为什么我制作一个 2dsphere 索引,但是当我查询时它会显示 s2cursor



为什么我做一个2dsphere索引,但是当我查询它显示s2cursor时,我认为它应该是geosearchcursor。 MongoDB文件是这样说的:http://docs.mongodb.org/manual/reference/method/cursor.explain/#explain-output-fields-core

游标

是一个字符串,用于报告查询使用的游标类型 操作:

基本游标表示完全集合扫描。BtreeCursor 表示 查询使用了索引。游标包括索引的名称。 当查询使用索引时,explain() 的输出包括 索引边界详细信息。GeoSearchCursor 指示查询使用了 地理空间指数。

我的文档:

{
    "_id" : "b2lblohv6qvcwzd6o2pcqep8v0",
    "eventid" : "b2lblohv6qvcwzd6o2pcqep8v0",
    "loc" : {
        "type" : "Point",
        "coordinates" : [
            -122.4127337,
            37.7709975
        ]
    },
    "end" : 1379399400,
    "start" : 1379392200,
}

这是我的MongoDB shell输出:

> db.collection_ca1.ensureIndex({'loc':'2dsphere'})
> db.collection_ca1.find({'loc':{'$geoWithin':{'$centerSphere':[[-118.397264,34.019763], 0.00001]}}}).explain()
{
    "cursor" : "S2Cursor",
    "isMultiKey" : true,
    "n" : 1979,
    "nscannedObjects" : 1979,
    "nscanned" : 25482,
    "nscannedObjectsAllPlans" : 1979,
    "nscannedAllPlans" : 25482,
    "scanAndOrder" : false,
    "indexOnly" : false,
    "nYields" : 6,
    "nChunkSkips" : 0,
    "millis" : 12215,
    "indexBounds" : {
    },
    "nscanned" : 25482,
    "matchTested" : NumberLong(23503),
    "geoTested" : NumberLong(23503),
    "cellsInCover" : NumberLong(1),
    "server" : "localhost:27017"
}

该文档尚未针对 2.4 中添加的"2dsphere"索引进行更新。

S2Cursor 是对"2dsphere"索引的优化搜索。

您应该向 DOCS 项目提交 Jira 票证以对其进行更新:https://jira.mongodb.org/browse/DOCS

最新更新