diff options
Diffstat (limited to 'jstests/core/sort7.js')
-rw-r--r-- | jstests/core/sort7.js | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/jstests/core/sort7.js b/jstests/core/sort7.js index 0b98734e5ff..4377cd5d17b 100644 --- a/jstests/core/sort7.js +++ b/jstests/core/sort7.js @@ -5,21 +5,21 @@ t.drop(); // Compare indexed and unindexed sort order for an array embedded field. -t.save( { a : [ { x : 2 } ] } ); -t.save( { a : [ { x : 1 } ] } ); -t.save( { a : [ { x : 3 } ] } ); -unindexed = t.find().sort( {"a.x":1} ).toArray(); -t.ensureIndex( { "a.x" : 1 } ); -indexed = t.find().sort( {"a.x":1} ).hint( {"a.x":1} ).toArray(); -assert.eq( unindexed, indexed ); +t.save({a: [{x: 2}]}); +t.save({a: [{x: 1}]}); +t.save({a: [{x: 3}]}); +unindexed = t.find().sort({"a.x": 1}).toArray(); +t.ensureIndex({"a.x": 1}); +indexed = t.find().sort({"a.x": 1}).hint({"a.x": 1}).toArray(); +assert.eq(unindexed, indexed); // Now check when there are two objects in the array. t.remove({}); -t.save( { a : [ { x : 2 }, { x : 3 } ] } ); -t.save( { a : [ { x : 1 }, { x : 4 } ] } ); -t.save( { a : [ { x : 3 }, { x : 2 } ] } ); -unindexed = t.find().sort( {"a.x":1} ).toArray(); -t.ensureIndex( { "a.x" : 1 } ); -indexed = t.find().sort( {"a.x":1} ).hint( {"a.x":1} ).toArray(); -assert.eq( unindexed, indexed ); +t.save({a: [{x: 2}, {x: 3}]}); +t.save({a: [{x: 1}, {x: 4}]}); +t.save({a: [{x: 3}, {x: 2}]}); +unindexed = t.find().sort({"a.x": 1}).toArray(); +t.ensureIndex({"a.x": 1}); +indexed = t.find().sort({"a.x": 1}).hint({"a.x": 1}).toArray(); +assert.eq(unindexed, indexed); |