MongoDB explain()游标字段

时间:2015-06-16 16:24:45

标签: mongodb

我开始调查MongoDB并且正在调查查询统计信息并通过索引进行优化。我正在阅读的例子使用explain函数,但它们的输出与我的不同。

他们看起来像:

{
    "cursor" : "BtreeCursor username_1",
    "nscanned" : 1,
    "nscannedObjects" : 1,
    "n" : 1,
    "millis" : 3,
    "nYields" : 0,
    "nChunkSkips" : 0,
    "isMultiKey" : false,
    "indexOnly" : false,
    "indexBounds" : {
        "username" : [
            [
                "user101",
                "user101"
            ]
        ]
    }
}
我的同时:

{
    "queryPlanner" : {
        "plannerVersion" : 1,
        "namespace" : "yodemo2-dev.indexTest",
        "indexFilterSet" : false,
        "parsedQuery" : {
            "$and" : [ ]
        },
        "winningPlan" : {
            "stage" : "COLLSCAN",
            "filter" : {
                "$and" : [ ]
            },
            "direction" : "forward"
        },
        "rejectedPlans" : [ ]
    },
    "serverInfo" : {
        "host" : "Andromache.local",
        "port" : 27017,
        "version" : "3.0.3",
        "gitVersion" : "nogitversion"
    },
    "ok" : 1
}

我也使用了详细版本,尽管在示例中并非如此,但无济于事。

我如何得到他们的结果?

1 个答案:

答案 0 :(得分:2)

explain()输出在3.0中更改。 “他们的”是<3.0输出。