1.查看数据库在当前集合上做什么操作
--查看当前MongoDB的集合上在做什么动作。
db.currentOp({"active":true,"ns":"mydb1.mycollection2"}).command;
db.currentOp({"active":true,"ns":"mydb1.mycollection2"}).inprog;
2.创建hash索引及hash分片
--创建HASH索引
db.createCollection("mycollection3");
db.getCollection('mycollection3').createIndex({"DeviceId":"hashed"});
sh.shardCollection("mydb1.mycollection3",{"DeviceId":"hashed"});