示例
创建一个普通集合,然后将该集合修改为分区集合。
db.sample.createCL('employee')
>
> db.sample.employee.setAttributes( { ShardingKey: { a: 1 }, ShardingType: "hash" } )
创建一个普通集合,然后将该集合修改为分区集合,并且自动切分:
db.sample.createCL('employee')
db.sample.employee.setAttributes( { ShardingKey: { a: 1 }, ShardingType: "hash", AutoSplit: true } )
创建一个普通集合,然后将该集合修改为 snappy 压缩
db.sample.createCL('employee')
db.sample.employee.setAttributes( { CompressionType: 'snappy' } )
创建一个有自增字段的集合,修改其自增起始值
db.sample.createCL( 'employee', { AutoIncrement: { Field: "studentID" } } )
db.sample.employee.setAttributes( { AutoIncrement: { Field: "studentID", StartValue: 2017140000 } } )
点击巨杉数据库文档中心了解更多信息