Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- map_func = Code("""
- function () {
- emit(this.timestamp, [this.publish_bytes, this.subscribe_bytes, this.history_bytes, this.time_bytes,
- this.unknown_bytes, this.publish, this.subscribe, this.history, this.unknown, this.time]);
- }
- """)
- reduce_func = Code("""
- function (key, values) {
- var totals = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
- for (var i=0; i<values.length; i++) {
- for (var j=0; j<values[i].length; j++) {
- totals[j] += values[i][j];
- }
- }
- return totals;
- }
- """)
- results = db.system_stats.inline_map_reduce(map_func, reduce_func)
Add Comment
Please, Sign In to add comment