diff options
Diffstat (limited to 'jstests/core/sort_numeric.js')
-rw-r--r-- | jstests/core/sort_numeric.js | 36 |
1 files changed, 17 insertions, 19 deletions
diff --git a/jstests/core/sort_numeric.js b/jstests/core/sort_numeric.js index 807f23dfe8d..df4e914b87b 100644 --- a/jstests/core/sort_numeric.js +++ b/jstests/core/sort_numeric.js @@ -5,31 +5,29 @@ t.drop(); // there are two numeric types int he db; make sure it handles them right // for comparisons. -t.save( { a : 3 } ); -t.save( { a : 3.1 } ); -t.save( { a : 2.9 } ); -t.save( { a : 1 } ); -t.save( { a : 1.9 } ); -t.save( { a : 5 } ); -t.save( { a : 4.9 } ); -t.save( { a : 2.91 } ); - -for( var pass = 0; pass < 2; pass++ ) { - - var c = t.find().sort({a:1}); +t.save({a: 3}); +t.save({a: 3.1}); +t.save({a: 2.9}); +t.save({a: 1}); +t.save({a: 1.9}); +t.save({a: 5}); +t.save({a: 4.9}); +t.save({a: 2.91}); + +for (var pass = 0; pass < 2; pass++) { + var c = t.find().sort({a: 1}); var last = 0; - while( c.hasNext() ) { + while (c.hasNext()) { current = c.next(); - assert( current.a > last ); + assert(current.a > last); last = current.a; } - assert( t.find({a:3}).count() == 1 ); - assert( t.find({a:3.0}).count() == 1 ); - assert( t.find({a:3.0}).length() == 1 ); + assert(t.find({a: 3}).count() == 1); + assert(t.find({a: 3.0}).count() == 1); + assert(t.find({a: 3.0}).length() == 1); - t.ensureIndex({a:1}); + t.ensureIndex({a: 1}); } assert(t.validate().valid); - |