Permalink
Browse files

prettier printShardingStatus()

  • Loading branch information...
1 parent 97aa0c2 commit 226b6f8ad6deac7ce67e19642911d59274083566 @RedBeard0531 RedBeard0531 committed Apr 30, 2010
Showing with 12 additions and 9 deletions.
  1. +12 −9 shell/servers.js
View
@@ -304,17 +304,20 @@ printShardingStatus = function( configDB ){
output( " databases:" );
configDB.databases.find().sort( { name : 1 } ).forEach(
- function(z){
- output( "\t" + tojson(z,"",true) );
+ function(db){
+ output( "\t" + tojson(db,"",true) );
- output( "\t\tmy chunks" );
-
- configDB.chunks.find( { "ns" : new RegExp( "^" + z._id ) } ).sort( { ns : 1 , min : 1 } ).forEach(
- function(z){
- output( "\t\t\t" + z.ns + " " + tojson( z.min ) + " -->> " + tojson( z.max ) +
- " on : " + z.shard + " " + tojson( z.lastmod ) );
+ if (db.partitioned){
+ for (ns in db.sharded){
+ output("\t\t" + ns + " chunks:");
+ configDB.chunks.find( { "ns" : ns } ).sort( { min : 1 } ).forEach(
+ function(chunk){
+ output( "\t\t\t" + tojson( chunk.min ) + " -->> " + tojson( chunk.max ) +
+ " on : " + chunk.shard + " " + tojson( chunk.lastmod ) );
+ }
+ );
}
- );
+ }
}
);

0 comments on commit 226b6f8

Please sign in to comment.