-
Type: Improvement
-
Resolution: Won't Do
-
Priority: Major - P3
-
None
-
Affects Version/s: None
-
Component/s: Index Maintenance
-
Labels:
-
Storage Execution
-
(copied to CRM)
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" : [ ] }, }