安装好后
创建集合(也就是表)
sdb
var db = new sdb("localhost", 11810);
db.createdomain("company_domains", [ "group1", "group2", "group3" ], { autosplit: true } );
db.createcs("company", { domain: "company_domains" } );
db.company.createcl("employee", { "shardingkey": { "_id": 1}, "shardingtype": "hash", "replsize": -1, "compressed": true, "compressiontype": "lzw", "autosplit": true, "ensureshardingindex": false });
创建索引,看执行计划
sdb
var db = new sdb("localhost", 11810);
db.company.employee.createindex("idx_ename", { ename: 1 }, false);
db.company.employee.find( { "ename": { "$et": "georgi" } } ).explain();
阅读(1797) | 评论(0) | 转发(0) |