- 
    Type:Bug 
- 
    Resolution: Duplicate
- 
    Priority:Minor - P4 
- 
    None
- 
    Affects Version/s: 2.4.8
- 
    Component/s: Querying
- 
    None
- 
    Environment:Mac OS X or Linux, mongodb 2.4.8, mongo 2.4.8
- 
        Major Change
- 
        ALL
- 
        None
- 
        None
- 
        None
- 
        None
- 
        None
- 
        None
- 
        None
If document has field with name "query", querying this field with "$in" operator fails. Here are steps to reproduce:
test.js
db.test.insert({q: 'test', i: 1});
db.test.insert({q: 'shmest', i: 2});
db.test.insert({q: 'quest', i: 3});
db.test.ensureIndex({q: 1});
db.test.find({q: {$in: ['test', 'shmest']}});
//{ "_id" : ObjectId("5294c0b2c32bf844e1f74e52"), "q" : "shmest", "i" : 2 }
//{ "_id" : ObjectId("5294c09fc32bf844e1f74e51"), "q" : "test", "i" : 1 }
db.test.count({q: {$in: ['test', 'shmest']}});
//2
db.test.remove();
db.test.insert({query: 'test', i: 1});
db.test.insert({query: 'shmest', i: 2});
db.test.insert({query: 'quest', i: 3});
db.test.ensureIndex({query: 1});
db.test.find({query: {$in: ['test', 'shmest']}});
//query fails: no response (and on large collection it takes a lot of time as if there's no index)
db.test.count({query: {$in: ['test', 'shmest']}});
//2
db.test.find({query: 'test'});
//{ "_id" : ObjectId("5294c166c32bf844e1f74e55"), "query" : "test", "i" : 1 }
//db.test.find({query: 'shmest'});
{ "_id" : ObjectId("5294c166c32bf844e1f74e56"), "query" : "shmest", "i" : 2 }
db.test.find({$or: [{query: 'test'}, {query: 'shmest'}]});
//{ "_id" : ObjectId("5294c166c32bf844e1f74e55"), "query" : "test", "i" : 1 }
//{ "_id" : ObjectId("5294c166c32bf844e1f74e56"), "query" : "shmest", "i" : 2 }
- duplicates
- 
                    SERVER-8025 shell supports "query" works as a meta-operator - only "$query" should be supported -         
- Closed
 
-         
- 
                    SERVER-9812 User query is interpreted incorrectly if the first field is "query" -         
- Closed
 
-