diff options
author | Eliot Horowitz <eliot@10gen.com> | 2010-02-12 23:58:46 -0500 |
---|---|---|
committer | Eliot Horowitz <eliot@10gen.com> | 2010-02-12 23:58:46 -0500 |
commit | ff767ba537c5642ba087db25df0c2a9b71401451 (patch) | |
tree | 89aa5b8face6630eab659cce4d39530ada44af49 | |
parent | 51ebf0fc741727511cb15c95c6c8edbf533f8fe9 (diff) | |
download | mongo-ff767ba537c5642ba087db25df0c2a9b71401451.tar.gz |
test for SERVER-635
-rw-r--r-- | jstests/sort6.js | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/jstests/sort6.js b/jstests/sort6.js new file mode 100644 index 00000000000..3fa8a923ada --- /dev/null +++ b/jstests/sort6.js @@ -0,0 +1,20 @@ + +t = db.sort6; +t.drop(); + +t.insert({_id:1}) +t.insert({_id:2}) +t.insert({_id:3,c:1}) +t.insert({_id:4,c:2}) + +function get( x ){ + return t.find().sort( { c : x } ).map( function(z){ return z._id; } ); +} + +//assert.eq( [4,3,2,1] , get( -1 ) , "A1" ) +assert.eq( [1,2,3,4] , get( 1 ) , "A2" ) + +t.ensureIndex( { c : 1 } ); + +assert.eq( [4,3,2,1] , get( -1 ) , "B1" ) +assert.eq( [1,2,3,4] , get( 1 ) , "B2" ) |