为什么我做一个2dsphere指数,但是当我查询它显示s2cursor? [英] why i make a 2dsphere index ,but when i query it shows s2cursor?

查看:324
本文介绍了为什么我做一个2dsphere指数,但是当我查询它显示s2cursor?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为什么我做一个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'索引的优化的搜索。

您应该提交吉拉票,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

这篇关于为什么我做一个2dsphere指数,但是当我查询它显示s2cursor?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆