summaryrefslogtreecommitdiff
path: root/src/mongo/shell/shardingtest.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/shell/shardingtest.js')
-rw-r--r--src/mongo/shell/shardingtest.js9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/mongo/shell/shardingtest.js b/src/mongo/shell/shardingtest.js
index 944306fbb19..c2fb575c13e 100644
--- a/src/mongo/shell/shardingtest.js
+++ b/src/mongo/shell/shardingtest.js
@@ -665,8 +665,13 @@ printShardingStatus = function( configDB , verbose ){
output( "\t\t\tshard key: " + tojson(coll.key) );
output( "\t\t\tchunks:" );
- res = configDB.chunks.group( { cond : { ns : coll._id } , key : { shard : 1 },
- reduce : function( doc , out ){ out.nChunks++; } , initial : { nChunks : 0 } } );
+ res = configDB.chunks.aggregate( { $match : { ns : coll._id } } ,
+ { $group : { _id : "$shard" ,
+ cnt : { $sum : 1 } } } ,
+ { $project : { _id : 0 ,
+ shard : "$_id" ,
+ nChunks : "$cnt" } } ,
+ { $sort : { shard : 1 } } ).toArray();
var totalChunks = 0;
res.forEach( function(z){
totalChunks += z.nChunks;