summaryrefslogtreecommitdiff
path: root/jstests/sort1.js
diff options
context:
space:
mode:
authorAaron <aaron@10gen.com>2012-01-04 14:34:55 -0800
committerAaron <aaron@10gen.com>2012-01-04 14:34:55 -0800
commit2306a5231c3632cd1198d14230058f0c1c2defe5 (patch)
tree8e639786efdd605f4c5d29cd997edfb3a5c990e6 /jstests/sort1.js
parentc93e6d520102f25e102c66649cd40c2207db4df4 (diff)
downloadmongo-2306a5231c3632cd1198d14230058f0c1c2defe5.tar.gz
add missing index to sort1 test, clean collection names, remove incorrect comment
Diffstat (limited to 'jstests/sort1.js')
-rw-r--r--jstests/sort1.js28
1 files changed, 13 insertions, 15 deletions
diff --git a/jstests/sort1.js b/jstests/sort1.js
index 341b3437feb..12b97728e90 100644
--- a/jstests/sort1.js
+++ b/jstests/sort1.js
@@ -1,10 +1,8 @@
-// test sorting, mainly a test ver simple with no index
-
debug = function( s ){
//print( s );
}
-t = db.sorrrt;
+t = db.sort1;
t.drop();
t.save({x:3,z:33});
@@ -28,23 +26,23 @@ for( var pass = 0; pass < 2; pass++ ) {
debug( "b" )
assert(t.validate().valid);
-
-db.sorrrt2.drop();
-db.sorrrt2.save({x:'a'});
-db.sorrrt2.save({x:'aba'});
-db.sorrrt2.save({x:'zed'});
-db.sorrrt2.save({x:'foo'});
+t.drop();
+t.save({x:'a'});
+t.save({x:'aba'});
+t.save({x:'zed'});
+t.save({x:'foo'});
debug( "c" )
for( var pass = 0; pass < 2; pass++ ) {
- debug( tojson( db.sorrrt2.find().sort( { "x" : 1 } ).limit(1).next() ) );
- assert.eq( "a" , db.sorrrt2.find().sort({'x': 1}).limit(1).next().x , "c.1" );
- assert.eq( "a" , db.sorrrt2.find().sort({'x': 1}).next().x , "c.2" );
- assert.eq( "zed" , db.sorrrt2.find().sort({'x': -1}).limit(1).next().x , "c.3" );
- assert.eq( "zed" , db.sorrrt2.find().sort({'x': -1}).next().x , "c.4" );
+ debug( tojson( t.find().sort( { "x" : 1 } ).limit(1).next() ) );
+ assert.eq( "a" , t.find().sort({'x': 1}).limit(1).next().x , "c.1" );
+ assert.eq( "a" , t.find().sort({'x': 1}).next().x , "c.2" );
+ assert.eq( "zed" , t.find().sort({'x': -1}).limit(1).next().x , "c.3" );
+ assert.eq( "zed" , t.find().sort({'x': -1}).next().x , "c.4" );
+ t.ensureIndex({x:1});
}
debug( "d" )
-assert(db.sorrrt2.validate().valid);
+assert(t.validate().valid);