summaryrefslogtreecommitdiff
path: root/jstests/aggregation/testall.js
diff options
context:
space:
mode:
authorU-tellus\cwestin <cwestin@10gen.com>2011-09-16 08:00:45 -0700
committerU-tellus\cwestin <cwestin@10gen.com>2011-09-16 08:00:45 -0700
commit83ebf01497063865f3a981417d280bc46b061952 (patch)
tree319ff63f2963c004e879fb403ddbabf90c037399 /jstests/aggregation/testall.js
parent8afbc5591681bbedb69be843ef5cb4f63ad81d2a (diff)
downloadmongo-83ebf01497063865f3a981417d280bc46b061952.tar.gz
re-enable shard pipeline split simulation; disabled ; server-3862: and
Diffstat (limited to 'jstests/aggregation/testall.js')
-rw-r--r--jstests/aggregation/testall.js38
1 files changed, 37 insertions, 1 deletions
diff --git a/jstests/aggregation/testall.js b/jstests/aggregation/testall.js
index 464e386666a..c9474397914 100644
--- a/jstests/aggregation/testall.js
+++ b/jstests/aggregation/testall.js
@@ -496,7 +496,8 @@ var p10 = db.runCommand(
{ $sort : {
key: {
title : 1
- }}}
+ }
+ }}
]});
var p10result = [
@@ -1258,3 +1259,38 @@ var g5result = [
];
assert(arrayEq(g5.result, g5result), 'g5 failed');
+
+
+// $first and $last accumulators
+var g6 = db.runCommand(
+{ aggregate : "article", pipeline : [
+ { $sort : {
+ key: {
+ author : -1
+ }
+ }},
+ /* TEMPORARY, until $group can use _id : <constant> */
+ { $project : {
+ author : 1,
+ bucket : { $add:[0, 1] }
+ }},
+ { $group : {
+ _id : { bucket : 1 },
+ firstAuthor : { $last : "$author" }, /* note reverse sort above */
+ lastAuthor : { $first : "$author" }, /* note reverse sort above */
+ count : { $sum : 1 }
+ }}
+]});
+
+var g6result = [
+ {
+ "_id" : {
+ "bucket" : 1
+ },
+ firstAuthor : "bob",
+ lastAuthor : "jane",
+ count : 3
+ }
+];
+
+assert(arrayEq(g6.result, g6result), 'g6 failed');