统计相关
user_daily_game表添加scene_id字段,并添加默认值
use conf
//添加scene_id字段,并添加默认值
db.getCollection("scene").find({}).forEach(
function(d){
use log
//好友房
if (d.game_type_id == 1)
{
db.getCollection("user_daily_game").updateMany({"game_id" : d.game_kind_id, "club_id" : 0}, {$set:{"scene_id" : NumberInt(d.id)}});
db.getCollection("user_month_game").updateMany({"game_id" : d.game_kind_id, "club_id" : 0}, {$set:{"scene_id" : NumberInt(d.id)}});
}
//俱乐部
else if(d.game_type_id == 2)
{
db.getCollection("user_daily_game").updateMany({"game_id" : d.game_kind_id, "club_id" : {$gt:0}}, {$set:{"scene_id" : NumberInt(d.id)}});
db.getCollection("user_month_game").updateMany({"game_id" : d.game_kind_id, "club_id" : {$gt:0}}, {$set:{"scene_id" : NumberInt(d.id)}});
}
});
user_daily_game 添加win_count等金币场输赢平局数统计
use log
//添加win_count等金币场输赢平局数统计
db.getCollection("user_daily_game").updateMany({}, {$set:{"win_count" : NumberInt(0), "lose_count" : NumberInt(0), "draw_count" : NumberInt(0), "fee_score" : NumberInt(0), "redpacket_count" : NumberInt(0)}});
db.getCollection("user_month_game").updateMany({}, {$set:{"win_count" : NumberInt(0), "lose_count" : NumberInt(0), "draw_count" : NumberInt(0), "fee_score" : NumberInt(0), "redpacket_count" : NumberInt(0)}});
user_daily_game 修改索引
//删除索引
db.getCollection("user_daily_game").dropIndex("user_id_1_club_id_1_date_id_1_game_id_1");
db.getCollection("user_month_game").dropIndex("user_id_1_club_id_1_date_id_1_game_id_1");
//添加索引
db.getCollection('user_daily_game').createIndex({"user_id":1,"club_id":1,"date_id":1,"scene_id":1,}, {"unique" : true, "background" : true})
db.getCollection('user_month_game').createIndex({"user_id":1,"club_id":1,"date_id":1,"scene_id":1,}, {"unique" : true, "background" : true})