在数据库中已经存在了一条索引:
{ "name" : "port_1", "key" : { "port" : 1 }, "host" : "loca:27017", "accesses" : { "ops" : NumberLong(1), "since" : ISODate("2017-05-11T15:27:25.749Z") } }
当我使用测试命令来:
db.base.find({"port":'80'}).explain()
结果是:
{
"queryPlanner" : {
"plannerVersion" : 1,
"namespace" : "mooz.base",
"indexFilterSet" : false,
"parsedQuery" : {
"port" : {
"$eq" : "80"
}
},
"winningPlan" : {
"stage" : "FETCH",
"inputStage" : {
"stage" : "IXSCAN",
"keyPattern" : {
"port" : 1
},
"indexName" : "port_1",
"isMultiKey" : false,
"multiKeyPaths" : {
"port" : [ ]
},
"isUnique" : false,
"isSparse" : false,
"isPartial" : false,
"indexVersion" : 2,
"direction" : "forward",
"indexBounds" : {
"port" : [
"[\"80\", \"80\"]"
]
}
}
},
"rejectedPlans" : [ ]
},
"serverInfo" : {
"host" : "loca",
"port" : 27017,
"version" : "3.4.3",
"gitVersion" : "f07437fb5a6cca07c10bafa78365456eb1d6d5e1"
},
"ok" : 1
}
为什么呢?是不是我打开的方式不对,求正确的解锁方式。谢谢
1
billlee 2017-05-12 00:05:55 +08:00 1
没有问题啊,先 IXSCAN port_1, 根据结果再 FETCH 整个文档
|