The actual change is in src/mongo/shell/collection.js with the remaining changes
to adjust tests to the new api.
The "ideal" arguments are now an array of pipeline ops and an optional object
with extra top-level options for the command (such as {explain: true}. For
backwards compatibility, we still support the varargs style where each argument
is a pipeline stage, but there is no way to specify extra parameters in this
mode.
21 lines
552 B
JavaScript
21 lines
552 B
JavaScript
// 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');
|