Files
mongo/jstests/core/sortf.js
Siyuan Zhou 3660343e0b SERVER-12127 migrate js tests to jscore suite when not related to writes
Migrate js tests starting from j-z.
Include SERVER-12920 Update use_power_of_2.js

Signed-off-by: Matt Kangas <matt.kangas@mongodb.com>
2014-03-03 22:54:10 -05:00

20 lines
471 B
JavaScript

// Unsorted plan on {a:1}, sorted plan on {b:1}. The unsorted plan exhausts its memory limit before
// the sorted plan is chosen by the query optimizer.
t = db.jstests_sortf;
t.drop();
t.ensureIndex( {a:1} );
t.ensureIndex( {b:1} );
for( i = 0; i < 100; ++i ) {
t.save( {a:0,b:0} );
}
big = new Array( 10 * 1000 * 1000 ).toString();
for( i = 0; i < 5; ++i ) {
t.save( {a:1,b:1,big:big} );
}
assert.eq( 5, t.find( {a:1} ).sort( {b:1} ).itcount() );
t.drop();