为什么我做一个2dsphere指数,但是当我查询它显示s2cursor?当我、我做、指数、s2cursor

由网友(不念过去、不畏将来)分享简介:为什么我做一个2dsphere指数,但是当我查询它显示s2cursor,我觉得应该是geosearchcursor。 MongoDB的文档中这样说:的http://docs.mongodb.org/manual/reference/method/cursor.explain/#explain-output-field...

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

  

光标是用于报告所使用的查询光标的类型的字符串   操作:

     

BasicCursor指示完全集合扫描。 BtreeCursor指示   该查询中使用的索引。光标包括索引的名字。   当查询使用索引,解释()的输出包括   indexBounds细节。 GeoSearchCursor表示查询中使用的   地理空间索引。

我的文档:

  {
    _id:b2lblohv6qvcwzd6o2pcqep8v0,
    事件ID:b2lblohv6qvcwzd6o2pcqep8v0,
    LOC:{
        类型:点,
        坐标:[
            -122.4127337,
            37.7709975
        ]
    },
    结束:1379399400,
    开始:1379392200,
}
 

这是我的MongoDB壳输出:

 > db.collection_ca1.ensureIndex({'禄':'2dsphere'})

> db.collection_ca1.find({禄:{$ geoWithin:{$ centerSphere':[ -  118.397264,34.019763],0.00001]}}})解释()。
{
    光标:S2Cursor
    isMultiKey:真实,
    N:19​​79年,
    nscannedObjects:1979年,
    nscanned:25482,
    nscannedObjectsAllPlans:1979年,
    nscannedAllPlans:25482,
    scanAndOrder:假的,
    indexOnly:假的,
    nYields:6,
    nChunkSkips:0,
    米利斯:12215,
    indexBounds:{

    },
    nscanned:25482,
    matchTested:NumberLong(23503),
    geoTested:NumberLong(23503),
    cellsInCover:NumberLong(1),
    服务器:本地主机:27017
}
 

解决方案

该文档尚未更新为'2dsphere人指数2.4增加。

的S2Cursor为'2dsphere'索引的优化的搜索。

proe4.0 2D基准面标注问题 我想把基准符号标在几何公差上,如下图

您应该提交吉拉票,DOCS项目得到它的更新:的https://jira.mongodb .ORG /浏览/文档

why i make a 2dsphere index ,but when i query it shows s2cursor, i think it should be geosearchcursor. the mongodb document says this: http://docs.mongodb.org/manual/reference/method/cursor.explain/#explain-output-fields-core

cursor is a string that reports the type of cursor used by the query operation:

BasicCursor indicates a full collection scan. BtreeCursor indicates that the query used an index. The cursor includes name of the index. When a query uses an index, the output of explain() includes indexBounds details. GeoSearchCursor indicates that the query used a geospatial index.

my document:

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

this is my mongodb shell output:

> 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"
}

解决方案

That documentation has not been updated for the '2dsphere' index added in 2.4.

The S2Cursor is the optimized search for a '2dsphere' index.

You should file a Jira ticket to the DOCS project to get it updated: https://jira.mongodb.org/browse/DOCS

阅读全文

相关推荐

最新文章