sh.shardCollection()

sh.shardCollection(collection, key, unique)
参数:
  • collection (string) – The namespace of the collection to shard.
  • key (document) – A document containing a shard key that the sharding system uses to partition and distribute objects among the shards.
  • unique (boolean) – When true, the unique option ensures that the underlying index enforces uniqueness so long as the unique index is a prefix of the shard key.

Shards the named collection, according to the specified shard key. Specify shard keys in the form of a document. Shard keys may refer to a single document field, or more typically several document fields to form a “compound shard key.”

See

Size of Sharded Collection

MongoDB Manual (Index)

关于

生态系统

格式

资源