Skip to content

Instantly share code, notes, and snippets.

@yesnault
Created August 21, 2014 12:53
Show Gist options
  • Save yesnault/b9912f681dd1b7ddc803 to your computer and use it in GitHub Desktop.
Save yesnault/b9912f681dd1b7ddc803 to your computer and use it in GitHub Desktop.
Soapower - useful query
// Count request per environment
db.requestData.aggregate( [ { $group : { _id : "$environmentName", count: { $sum: 1 } } } ] );
// Count all services
db.environments.aggregate(
[
{ $unwind : "$services" },
{ $group : { _id : null, number : { $sum : 1 } } }
]
);
// Count all services per environment
db.environments.aggregate(
[
{ $unwind : "$services" },
{ $group : { _id : "$name", number : { $sum : 1 } } },
{ $sort: { "_id": 1 } }
]
);
// Size in MB of requestData collection
db.requestData.stats(1024*1024).size
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment