Skip to content

Instantly share code, notes, and snippets.

@dbmurphy
Created October 10, 2014 22:21
Show Gist options
  • Save dbmurphy/991617195f10cda61ffe to your computer and use it in GitHub Desktop.
Save dbmurphy/991617195f10cda61ffe to your computer and use it in GitHub Desktop.
ChunkHunter example commands
//All Jumbo Chunks
db.foo.find({jumbo:true});
//Order By documents
db.foo.find({jumbo:true}).sort({docs:-1});
//Order By size
db.foo.find({jumbo:true}).sort({size:-1});
//Aggregate looking for jumbos by shard ( Set size and docs lower from 64/250k due to test size)
mongos> db.foo.aggregate({$match: { size : {$gt : 2},docs:{$gte: 25000}}},{$group: { _id:"$shard",count:{$sum:1}}})
{
"result" : [
{
"_id" : "4fa0d97504185879b6e7524dda47d98b",
"count" : 55
},
{
"_id" : "d42f619034d73616dabde1ed098739c2",
"count" : 54
},
{
"_id" : "d34ff18d819ea9dfeda0f638eae589f0",
"count" : 56
},
{
"_id" : "af6e8730844faa627625a6c3fa98f0fc",
"count" : 55
},
{
"_id" : "0e5302a229a01e20cf4e29ae4f352c54",
"count" : 55
}
],
"ok" : 1
}
//All jumbos on a shard
db.foo.find({shard:"0e5302a229a01e20cf4e29ae4f352c54",jumbo:true})
//By Jumbo Docs
db.foo.find({shard:"0e5302a229a01e20cf4e29ae4f352c54",docs:{$gte: 250000}})
//By Jumbo Size
db.foo.find({shard:"0e5302a229a01e20cf4e29ae4f352c54",size:{$gte: 64}})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment