use central;

db.createUser({
    user: "central", // 用户名
    pwd: "central0729", // 用户密码
    roles: [
        { role: "readWrite", db: "central" } // 分配角色和权限
    ]
});

db.getUsers();

db.createCollection("promotion_click_event"); //投放广告点击事件

db.promotion_click_event.createIndex({"createTime":-1},{"expireAfterSeconds":604800}); //7天有效期


db.createCollection("promotion_event_mapping"); //投放广告点击关键字段映射

db.promotion_event_mapping.getIndexes(); //查询索引

db.promotion_event_mapping.createIndex({"propName": 1, "md5": 1, "propValue": 1}); //复合索引

db.promotion_event_mapping.createIndex({"createTime":-1},{"expireAfterSeconds":604800}); //7天有效期


db.createCollection("user_data"); //用户数据

db.user_data.getIndexes(); //查询索引

db.user_data.createIndex({"ssid": 1}, { unique: true }); //唯一索引



db.createCollection("value_data"); //用户数据

db.value_data.getIndexes(); //查询索引

db.value_data.createIndex({"ssid": 1}, { unique: true }); //唯一索引