summaryrefslogtreecommitdiff
path: root/jstests/queryoptimizerc.js
blob: cb20876edc819d99119b75fb09061866d903a0d5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
// Use of an $atomic match expression does not affect choice of index.  SERVER-5354

t = db.jstests_queryoptimizerc;
t.drop();

function checkExplainResults( explain ) {
    assert.eq( 'BtreeCursor a_1', explain.cursor ); // a:1 index chosen.
    assert.eq( 1, explain.allPlans.length );        // Only one (optimal) plan is attempted.
}

t.ensureIndex( { a:1 } );

checkExplainResults( t.find( { a:1 } ).explain( true ) ); 
checkExplainResults( t.find( { a:1, $atomic:1 } ).explain( true ) );