-
Type: Task
-
Resolution: Done
-
Priority: Minor - P4
-
Affects Version/s: None
-
Component/s: manual
-
Labels:
Setup: create a toy collection that has no indices:
> t = db.t > t.drop() > t.save({a: 1})
Then, start a 2.4.x mongod with the --notablescan option:
> db.version() 2.4.9 > t.find({a: {$exists: true}}).explain() { "cursor" : "BasicCursor", ... }
Even though --notablescan was set, 2.4 is using a collection scan. This behavior has changed in 2.6:
> db.version() 2.6.0 > t.find({a: {$exists: true}}).explain() Wed Apr 9 10:39:16.316 error: { "$err" : "Unable to execute query: error processing query: ns=test.t limit=0 skip=0\nTree: a exists\nSort: {}\nProj: {}\n No query solutions", "code" : 17007 } at src/mongo/shell/query.js:128
Although the 2.6 is definitely more logical, this is a backwards breaking change that surprised at least one user (see SERVER-13520). We should doc this so it doesn't bite more users!
- is related to
-
SERVER-13520 The $exists operator fails if the field is not indexed when using --notablescan
- Closed