summaryrefslogtreecommitdiff
path: root/jstests/aggregation/bugs/server5209.js
blob: d0890c2b47a48d301b9930620ed8bca7280f4efb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
// use qa
db = db.getSiblingDB('qa');

db.aggtype.drop();
db.aggtype.insert({key: NumberInt(24), value: 17});
db.aggtype.insert({key: NumberLong(24), value: 8});
db.aggtype.insert({key: 24, value: 5});
db.aggtype.insert({key: NumberInt(42), value: 11});
db.aggtype.insert({key: NumberLong(42), value: 13});
db.aggtype.insert({key: 42, value: 6});

var at = db.aggtype.aggregate(
    {$group: {
        _id: "$key",
        s: {$sum: "$value"}
    }}
).toArray();

assert(at[0].s == 30, 'server5209 failed');
assert(at[1].s == 30, 'server5209 failed');