summaryrefslogtreecommitdiff
path: root/jstests/group1.js
diff options
context:
space:
mode:
authorEliot Horowitz <eliot@10gen.com>2009-06-08 10:54:55 -0400
committerEliot Horowitz <eliot@10gen.com>2009-06-08 10:54:55 -0400
commitd5122c9b90ef1f45585e09c45610488ff76894cf (patch)
tree594907f6b0c1283cae0b45d50a3f2425ab8f7399 /jstests/group1.js
parentb6e455fd69c2cb9d2bb12b39c8cc721f2e5c3f61 (diff)
downloadmongo-d5122c9b90ef1f45585e09c45610488ff76894cf.tar.gz
change Map to use Map.get Map.put Map[] won't work
more tests for group
Diffstat (limited to 'jstests/group1.js')
-rw-r--r--jstests/group1.js17
1 files changed, 17 insertions, 0 deletions
diff --git a/jstests/group1.js b/jstests/group1.js
new file mode 100644
index 00000000000..e7b1d5ef5d7
--- /dev/null
+++ b/jstests/group1.js
@@ -0,0 +1,17 @@
+t = db.group1;
+t.drop();
+
+t.save( { n : 1 , a : 1 } );
+t.save( { n : 2 , a : 1 } );
+t.save( { n : 3 , a : 2 } );
+t.save( { n : 4 , a : 2 } );
+t.save( { n : 5 , a : 2 } );
+
+
+res = t.group( { key : { a : true } ,
+ reduce: function(obj,prev) { prev.count++; },
+ initial: { count: 0 }
+ }
+ );
+
+printjson( res );