|
The plan enumerator outputs 6 plans for the below query (one for each of the first 6 six indexes created), none of which use the 7th / most optimal index {a: 1, h: 1}.
db.foo.ensureIndex({a: 1, b: 1});
|
db.foo.ensureIndex({a: 1, c: 1});
|
db.foo.ensureIndex({a: 1, d: 1});
|
db.foo.ensureIndex({a: 1, e: 1});
|
db.foo.ensureIndex({a: 1, f: 1});
|
db.foo.ensureIndex({a: 1, g: 1});
|
db.foo.ensureIndex({a: 1, h: 1});
|
|
for (var i = 0; i < 10000; i++) {
|
db.foo.insert({a: 1, h: i});
|
}
|
|
// Below assertion fails with "Error: [1] != [10000] are not equal"
|
assert.eq(1, db.foo.find({a: 1, h: 1}).explain().nscanned);
|
|