Type alias CreateCollectionOptions

CreateCollectionOptions: {
    cacheEnabled?: boolean;
    computedValues?: ComputedValueOptions[];
    distributeShardsLike?: string;
    enforceReplicationFactor?: boolean;
    keyOptions?: CollectionKeyOptions;
    numberOfShards?: number;
    replicationFactor?: number;
    schema?: SchemaOptions;
    shardKeys?: string[];
    shardingStrategy?: ShardingStrategy;
    smartGraphAttribute?: string;
    smartJoinAttribute?: string;
    waitForSync?: boolean;
    waitForSyncReplication?: boolean;
    writeConcern?: number;
}

Type declaration

  • Optional cacheEnabled?: boolean

    Whether the in-memory hash cache is enabled for this collection.

  • Optional computedValues?: ComputedValueOptions[]

    Computed values to apply to documents in this collection.

  • Optional distributeShardsLike?: string

    (Enterprise Edition cluster only.) If set to a collection name, sharding of the new collection will follow the rules for that collection. As long as the new collection exists, the indicated collection can not be dropped.

  • Optional enforceReplicationFactor?: boolean

    (Cluster only.) Unless set to false, the server will check whether enough replicas are available at creation time and bail out otherwise.

    Default: true

  • Optional keyOptions?: CollectionKeyOptions

    An object defining the collection's key generation.

  • Optional numberOfShards?: number

    (Cluster only.) Number of shards to distribute the collection across.

    Default: 1

  • Optional replicationFactor?: number

    (Cluster only.) How many copies of each document should be kept in the cluster.

    Default: 1

  • Optional schema?: SchemaOptions

    Options for validating documents in the collection.

  • Optional shardKeys?: string[]

    (Cluster only.) Document attributes to use to determine the target shard for each document.

    Default: ["_key"]

  • Optional shardingStrategy?: ShardingStrategy

    (Cluster only.) Sharding strategy to use.

  • Optional smartGraphAttribute?: string

    (Enterprise Edition cluster only.) Attribute used for sharding.

  • Optional smartJoinAttribute?: string

    (Enterprise Edition cluster only.) Attribute containing the shard key value of the referred-to smart join collection.

  • Optional waitForSync?: boolean

    If set to true, data will be synchronized to disk before returning from a document create, update, replace or removal operation.

    Default: false

  • Optional waitForSyncReplication?: boolean

    (Cluster only.) Unless set to false, the server will wait for all replicas to create the collection before returning.

    Default: true

  • Optional writeConcern?: number

    (Cluster only.) Write concern for this collection.