diff options
author | Eliot Horowitz <eliot@10gen.com> | 2015-03-11 17:45:49 -0400 |
---|---|---|
committer | Eliot Horowitz <eliot@10gen.com> | 2015-03-11 17:46:44 -0400 |
commit | f4d17dd81431f9724006c0837ccac44068971b1d (patch) | |
tree | 729b7d2035cb937a6bcfcf93c8e0730230a0b003 /jstests/aggregation | |
parent | f931ac5fa8d69d1b3e08267cd47ba14e5b3b30e2 (diff) | |
download | mongo-f4d17dd81431f9724006c0837ccac44068971b1d.tar.gz |
SERVER-8088: $unwind of scalar should return 1 doc with scalar
Diffstat (limited to 'jstests/aggregation')
-rw-r--r-- | jstests/aggregation/unwind.js | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/jstests/aggregation/unwind.js b/jstests/aggregation/unwind.js new file mode 100644 index 00000000000..d4c540436ae --- /dev/null +++ b/jstests/aggregation/unwind.js @@ -0,0 +1,15 @@ +// SERVER-8088: test $unwind with a scalar + +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 } ); + +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; })); |