Details
-
Improvement
-
Resolution: Unresolved
-
Major - P3
-
None
-
None
-
Storage Execution
-
(copied to CRM)
Description
We should consider reporting a warning if an index build on a non-empty collection does not encounter any documents containing the key(s) specified. This can happen, for example, if there is a typo in the command. Such a warning could help mitigate performance issues and reduce the time and resources required to investigate and correct.
> db.bar.findOne()
|
{
|
"_id" : ObjectId("596e1e46970f5ca6dfaaf7d7"),
|
"address" : "123 Main Street"
|
}
|
>
|
>//It would be nice if the output of the following command indicated that the misspelled "adress" field was not found while building the index
|
>
|
> db.bar.createIndex({adress:1})
|
{
|
"createdCollectionAutomatically" : false,
|
"numIndexesBefore" : 1,
|
"numIndexesAfter" : 2,
|
"ok" : 1
|
}
|
>
|
> db.bar.find({"address" : "123 Main Street"}).explain()
|
{
|
"queryPlanner" : {
|
"plannerVersion" : 1,
|
"namespace" : "foo.bar",
|
"indexFilterSet" : false,
|
"parsedQuery" : {
|
"address" : {
|
"$eq" : "123 Main Street"
|
}
|
},
|
"winningPlan" : {
|
"stage" : "COLLSCAN",
|
"filter" : {
|
"address" : {
|
"$eq" : "123 Main Street"
|
}
|
},
|
"direction" : "forward"
|
},
|
"rejectedPlans" : [ ]
|
},
|
}
|