diff options
Diffstat (limited to 'jstests/aggregation/unwind.js')
-rw-r--r-- | jstests/aggregation/unwind.js | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/jstests/aggregation/unwind.js b/jstests/aggregation/unwind.js index d4c540436ae..ba6ffa44a86 100644 --- a/jstests/aggregation/unwind.js +++ b/jstests/aggregation/unwind.js @@ -3,13 +3,16 @@ t = db.agg_unwind; t.drop(); -t.insert( {_id : 1 } ); -t.insert( {_id : 2, x : null } ); -t.insert( {_id : 3, x : [] } ); -t.insert( {_id : 4, x : [1, 2] } ); -t.insert( {_id : 5, x : [3] } ); -t.insert( {_id : 6, x : 4 } ); +t.insert({_id: 1}); +t.insert({_id: 2, x: null}); +t.insert({_id: 3, x: []}); +t.insert({_id: 4, x: [1, 2]}); +t.insert({_id: 5, x: [3]}); +t.insert({_id: 6, x: 4}); -var res = t.aggregate( [ { $unwind : "$x" }, { $sort : { _id : 1 } } ] ).toArray(); +var res = t.aggregate([{$unwind: "$x"}, {$sort: {_id: 1}}]).toArray(); assert.eq(4, res.length); -assert.eq([1, 2, 3, 4],res.map(function(z){ return z.x; })); +assert.eq([1, 2, 3, 4], + res.map(function(z) { + return z.x; + })); |