"SequoiaDB Giant Sequoia Database" setAttributes() Overview 2

parameter

  • options (  Objectrequired  )

    The optionsproperties of the collection can be modified through parameters, such as the partition key of the specified collection, whether to insert data in compressed form, etc. options The following options can be used in combination  :

    1. ReplSize (  Int32  ): The number of copies to be synchronized for write operations. The selectable values ​​are as follows:

      • -1: Indicates that the write request needs to be synchronized to several active nodes in the replication group before the database write operation returns a response to the client.
      • 0: Indicates that the write request needs to be synchronized to all nodes in the replication group before the database write operation returns a response to the client.
      • 1-7: Indicates that the write request needs to be synchronized to the specified number of nodes in the replication group before the database write operation returns a response to the client.

      format:ReplSize: <num>

    2. ShardingKey (  Object  ): The partition key.

      format:ShardingKey:{<字段1> : <1|-1>,[<字段2> : <1|-1>, ...]}

      • The existing ShardingKey will be modified to a new ShardingKey
      • The collection can only exist in one data group, or the collection is the main table without sub-tables attached
    3. ShardingType (  String  ): Partition mode, the default is hash partition. The selectable values ​​are as follows:

      • "hash": hash partition.
      • "range": Range partition.

      format:ShardingType : "hash" | "range"

      • The collection can only exist in one data group
    4. Partition (  Int32  ): The number of partitions. Fill in only when selecting hash partition, it represents the number of hash partitions. Its value must be a power of 2. The range is [2^3, 2^20].

      format:Partition : <分区数>

      • The collection can only exist in one data group
    5. AutoSplit (  Bool  ): Identifies whether the automatic segmentation function is enabled for the new collection

      format:AutoSplit : true | false

      • The default value is false
      • After setting a new hash partition key for the collection, you can use this option for automatic segmentation
      • When AutoSplit is not explicitly specified, if AutoSplit is not specified before modification of the collection and belongs to a non-system domain, the AutoSplit parameter of the domain will take effect on this setting
        • Before the collection, AutoSplit is specified as false, so you need to explicitly set AutoSplit to true for automatic segmentation
      • AutoSplit can only act on the hash partition key
    6. EnsureShardingIndex (  Bool  ): Identifies whether to create a partition index

      • The default value is true
    7. Compressed (  Bool  ): Identifies whether the collection is enabled for data compression.

      format:Compressed : true | false

      • If Compressed is set to true but CompressionType is not specified, then CompressionType is "lzw"
    8. CompressionType (  String  ): The compression algorithm of the collection, "snappy" or "lzw".

      • "snappy": Use snappy algorithm to compress.
      • "lzw": Use lzw algorithm to compress.

      format:CompressionType : "snappy" | "lzw"

    9. StrictDataMode (  Bool  ): Identifies whether the strict data type mode is enabled for the operation on the collection

      format:StrictDataMode : true | false

    10. AutoIncrement (  Object  ): Auto-increment field

      format:AutoIncrement : <option>

      • Field attribute must be added to option to mark the field to be modified.
      • The properties that can be modified by the self-increment field are CurrentValue, Increment, StartValue, MinValue, MaxValue, CacheSize, AcquireSize, Cycled, Generated.
        Please refer to the introduction of auto-increment fields for the specific functions of attributes  .
      • After modifying the attribute, the field value may not be unique. To ensure that the modified value is unique, it is recommended to use a unique index.

    Note:

    • For the specific usage of each option, see  db.collectionspace.createCL() .
    • The partition set cannot modify the attributes related to the partition, such as ShardingKey, Partition, etc.
    • EnsureShardingIndex and AutoSplit are only effective for the current operation, only when the partition properties such as ShardingKey are modified

Click on Jushan Database Documentation Center for more information

Guess you like

Origin blog.csdn.net/weixin_48909806/article/details/112968554