首页 > 其他 > 详细

统计脚本。

时间:2015-08-14 15:15:25      阅读:174      评论:0      收藏:0      [点我收藏+]

 


function groupChatCount(){
var count = 0;
var rows = db.historyGroup.find();
for(var i=0, len = rows.length(); i < len; i++){
count = count + rows[i].msgCount;
}
print("groupChat:" + count);
}

groupChatCount();

 

function chatCount(){
var count = 0;
var rows = db.historyOneToOne.find();
for(var i=0, len = rows.length(); i < len; i++){
count = count + rows[i].msgCount;
}
print("chat:" + count);
}

chatCount();

// 多表统计
function notify(){
var tables = new Array()
for(var i = 0; i < 64; i++){
tables.push("notifyMessageNew" + i);
}

var count = 0;
for(var i = 0; i < tables.length; i++){
count = count + db.getCollection(tables[i]).count();
}

print("notify:" + count);
}

// 多表统计
function notify(){
var count = 0;
for(var i = 0; i < 64; i++){
var v = db.getCollection(‘notifyMessageNew‘+i).count();
count = count + v;
}
print("notify:" + count);
}

 

统计脚本。

原文:http://www.cnblogs.com/hujihon/p/4729971.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!