Skip to content

Instantly share code, notes, and snippets.

@rhyskeepence
Created September 5, 2012 11:48
Show Gist options
  • Save rhyskeepence/3635507 to your computer and use it in GitHub Desktop.
Save rhyskeepence/3635507 to your computer and use it in GitHub Desktop.
mongo db aggregation output
command: { aggregate: "activemq_berylcoral", pipeline: [ { $match: { _id: { $gte: 1346281200000 } } }, { $group: { _id: { $divide: [ "$_id", 86400000 ] }, aggregation: { $avg: "$jvmThreadCount" } } } ] } ntoreturn:1 keyUpdates:0 numYields: 1 locks(micros) r:2162903 reslen:246035 1379ms
command: { mapreduce: "activemq_berylcoral", map: "function() { emit(this._id - (this._id % 86400000), { aggregate:0, count:1, sum: this['jvmThreadCount'] } );}", reduce: "
function (name, values) {
var result = { aggregate:0, count:0, sum:0 };
values.forEach(function(f) {
result.sum += f.sum;
...", verbose: false, out: { inline: true }, query: { _id: { $gte: 1346281200000 } }, finalize: "
function (who, res) {
if (res.count > 0) res.aggregate = res.sum / res.count;
return res;
}
" } ntoreturn:1 keyUpdates:0 numYields: 54 locks(micros) r:518920 reslen:285 315ms
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment