t = db.distinct_index1
t.drop();
for ( i=0; i < 100; ++i ) {
t.insert( {a: i%10} );
}
t.ensureIndex({a:1});
t.runCommand( "distinct" , { key : 'a' , query : { a : { $in : [2, 4, 6, 8] } } } );
{
"values" : [
2,
4,
6,
8
],
"stats" : {
"n" : 40,
"nscanned" : 43,
"nscannedObjects" : 40,
"timems" : 12,
"cursor" : "BtreeCursor a_1"
},
"ok" : 1
}
t.runCommand( "distinct" , { key : 'a' , query :{ $or: [{a:3}, {a:5}] } } );
{
"values" : [
3,
5
],
"stats" : {
"n" : 20,
"nscanned" : 21,
"nscannedObjects" : 20,
"timems" : 0,
"cursor" : "BtreeCursor a_1"
},
"ok" : 1
}