Mongodb文件检查计数

时间:2018-12-27 07:58:37

标签: mongodb

我已经在user_Email上创建了索引。当我运行以下查询时,检查的文档总数已经进入了执行状态。

 db.getCollection('User').find({"user_Email" : "anandkumar@yahoo.com"}).explain("executionStats");

输出:

    "executionStats" : {
        "executionSuccess" : true,
        "nReturned" : 1,
        "executionTimeMillis" : 1,
        "totalKeysExamined" : 1,
        "totalDocsExamined" : 1,
        "executionStages" : {
            "stage" : "FETCH",
            "nReturned" : 1,
            "executionTimeMillisEstimate" : 0,
            "works" : 2,
            "advanced" : 1,
            "needTime" : 0,
            "needYield" : 0,
            "saveState" : 0,
            "restoreState" : 0,
            "isEOF" : 1,
            "invalidates" : 0,
            "docsExamined" : 1,
            "alreadyHasObj" : 0,
            "inputStage" : {
                "stage" : "IXSCAN",
                "nReturned" : 1,
                "executionTimeMillisEstimate" : 0,
                "works" : 2,
                "advanced" : 1,
                "needTime" : 0,
                "needYield" : 0,
                "saveState" : 0,
                "restoreState" : 0,
                "isEOF" : 1,
                "invalidates" : 0,
                "keyPattern" : {
                    "user_Email" : 1.0
                },
                "indexName" : "user_Email_1",
                "isMultiKey" : false,
                "multiKeyPaths" : {
                    "user_Email" : []
                },
                "isUnique" : false,
                "isSparse" : false,
                "isPartial" : false,
                "indexVersion" : 2,
                "direction" : "forward",
                "indexBounds" : {
                    "user_Email" : [ 
                        "[\"anandkumar@yahoo.com\", \"anandkumar@yahoo.com\"]"
                    ]
                },
                "keysExamined" : 1,
                "seeks" : 1,
                "dupsTested" : 0,
                "dupsDropped" : 0,
                "seenInvalidated" : 0
            }
        }
    },

}

当我从如下所示的汇总中运行时。我没有得到检查的文档计数。如何查找聚集中的经检验的文档。

var myexp = db.getCollection('User').explain("executionStats")
myexp.aggregate([
{$match:{"user_Email" : "anandkumar@yahoo.com"}},
]

);
当我使用聚合时,

exectionStats项未得到结果。

0 个答案:

没有答案