#启用数据库分片
sh.enableSharding("vcollege")
#创建集合
db.sys_logs.insert({"_id":ObjectId("5efed792943fafb741259c0c"),"userId":"123456","account":"13375413295","schoolId":"2","busiModel":"登录模块","operation":"获取菜单权限列表","ip":"127.0.0.1, 222.175.156.230","createTime":ISODate("2019-11-15T08:30:38.000Z")})
#创建索引
db.sys_logs.ensureIndex({"schoolId": 1, "userId": 1})
#分片
sh.shardCollection("vcollege.sys_logs",{"schoolId": 1, "userId": 1})
#查看分片情况
sh.status()
#创建集合
db.smsLog.insert({"_id":ObjectId("5efee40cbb8f16bb31bdb709"),"inparam":"18366660091","outparam":"843325&{\"code\":\"0\",\"data\":{\"taskid\":\"052280811263662269276835840\"},\"msg\":\"提交成功\"}","calltime":ISODate("2020-05-22T02:45:37.343Z"),"backtime":ISODate("2020-05-22T02:45:37.343Z"),"type":1.0})
#创建索引
db.smsLog.ensureIndex({"inparam": 1})
#分片
sh.shardCollection("vcollege.smsLog",{"inparam": 1})
#查看分片情况
sh.status()
#创建集合
db.live_comment.insert({"_id":ObjectId("5efee8cabb8f16bb31bdb70a"),"schoolId":37.0,"liveId":12.0,"studentId":1059.0,"studentName":"20级网络与新媒体100","content":"测试","createTime":ISODate("2020-06-17T07:01:41.016Z")})
#创建索引
db.live_comment.ensureIndex({"schoolId": 1,"studentId":1})
#分片
sh.shardCollection("vcollege.live_comment",{"schoolId": 1,"studentId":1})
#查看分片情况
sh.status()
#创建集合
db.app_student_logs.insert({"_id":ObjectId("5efeeb049450b307a736016f"),"schoolId":37.0,"studentId":925.0,"account":"18366660021","busiModel":"学生登录模块","operation":"20级新闻21登录学生端","clientType":"MI NOTE LTE","clientVersion":"MI NOTE LTE","appVersion":"1.0.1","createTime":ISODate("2020-07-01T07:01:28.000Z")})
#创建索引
db.app_student_logs.ensureIndex({"schoolId": 1,"studentId":1})
#分片
sh.shardCollection("vcollege.app_student_logs",{"schoolId": 1,"studentId":1})
#查看分片情况
sh.status()
#创建集合
db.app_message.insert({"_id":ObjectId("5efef5ec9450b307a7360172"),"messageId":82.0,"studentId":909.0,"tdInfoId":1018.0,"title":"老师接收","desc":"我是消介我是","content":"<p>我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是</p>","type":"1","businessType":"message_school","userType":"1","rangeType":"1","releaseTime":ISODate("2020-06-04T02:23:52.354Z"),"status":"2","isRead":"1","createUser":"18500000000","createTime":ISODate("2020-06-04T02:23:52.132Z"),"appClientid":"d82304e02312e6d6a5f31705e8d98947","platfrom":"app","schoolId":37.0})
#创建索引
db.app_message.ensureIndex({"schoolId": 1,"studentId":1,"teacherId":1,"messageId":1})
#分片
sh.shardCollection("vcollege.app_message",{"schoolId": 1})
#查看分片情况
sh.status()