Following MongoDB documentation example seems to be wrong.
Any suggestion?
a== 1 and a >5 will never match any document.
db.foo.find( { $and: [ { a: 1 }, { a: { $gt: 5 } } ] } )
In the above example documents with an element of a having a value of a equal to 1 and a value of a greater than 5 will be returned
You are missing an import line in the example:
The insert will give you a record looking like the following:
So the find will return any result where a == 1 and a also has a value greater than 5. In this case, a can be two values: http://www.mongodb.org/display/DOCS/Multikeys
The a is 1, and at the same time 10. So that is why this query would return this result.