diff options
Diffstat (limited to 'jstests/sortc.js')
-rw-r--r-- | jstests/sortc.js | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/jstests/sortc.js b/jstests/sortc.js index ae0109f7a9d..f9aa202508b 100644 --- a/jstests/sortc.js +++ b/jstests/sortc.js @@ -6,17 +6,24 @@ t.drop(); t.save( {a:1} ); t.save( {a:2} ); -function checkA( a, sort, skip ) { - assert.eq( a, t.find().sort( sort ).skip( skip )[ 0 ].a ); +function checkA( a, sort, skip, query ) { + query = query || {}; + assert.eq( a, t.find( query ).sort( sort ).skip( skip )[ 0 ].a ); } function checkSortAndSkip() { checkA( 1, {a:1}, 0 ); checkA( 2, {a:1}, 1 ); + checkA( 1, {a:1}, 0, {a:{$gt:0},b:null} ); + checkA( 2, {a:1}, 1, {a:{$gt:0},b:null} ); + checkA( 2, {a:-1}, 0 ); checkA( 1, {a:-1}, 1 ); + checkA( 2, {a:-1}, 0, {a:{$gt:0},b:null} ); + checkA( 1, {a:-1}, 1, {a:{$gt:0},b:null} ); + checkA( 1, {$natural:1}, 0 ); checkA( 2, {$natural:1}, 1 ); |