模式
{
"_id" : ObjectId("58db65b7e164191f175d12a3"),
"supplierId" : 9,
"resellerCode" : "k120",
"userName" : "",
"statusCode" : 200,
"bookingIds" : [ 275 ],
"stTripIds" : [],
"mysqlId" : 3474,
"request" : "",
"response" : "",
"requestTime" : ISODate("2017-01-27T15:13:46.000Z")
}
我有2个索引 1)resellerCode_1_requestTime_-1
{
"resellerCode" : 1,
"requestTime" : -1
}
2)supplierId_1_requestTime_-1
{
"supplierId" : 1,
"requestTime" : -1
}
当我进行此查询时
db.mycollection.explain('executionStats').count({ "resellerCode": "k120", "supplierId": 5 })
我看到Mongo只使用supplierId_1_requestTime_-1索引,并使用FETCH作为resellerCode。我无法为resellerCode_supplierId创建覆盖索引。
为什么MongoDB在这种情况下不能使用索引相交?