标签:
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