Interface CollectionOptions

Options for spawning a new Collection instance through db.collection or db.createCollection.

Note that these are not all the options available for when you're actually creating a table—see CreateCollectionOptions for that.

Field

embeddingApiKey - The embedding service's API-key/headers (for $vectorize)

Field

timeoutDefaults - Default timeouts for all collection operations

Field

logging - Logging configuration overrides

Field

serdes - Additional serialization/deserialization configuration

interface CollectionOptions {
    embeddingApiKey?: null | string | EmbeddingHeadersProvider;
    keyspace?: string;
    logging?: DataAPILoggingConfig;
    serdes?: CollectionSerDesConfig;
    timeoutDefaults?: Partial<TimeoutDescriptor>;
}

Hierarchy (view full)

Properties

embeddingApiKey?: null | string | EmbeddingHeadersProvider

The API key for the embedding service to use, or the EmbeddingHeadersProvider if using a provider that requires it (e.g. AWS bedrock).

keyspace?: string

The keyspace to use for the operation.

The configuration for logging events emitted by the DataAPIClient.

This can be set at any level of the major class hierarchy, and will be inherited by all child classes.

See DataAPILoggingConfig for much more information on configuration, outputs, and inheritance.

Advanced & currently somewhat unstable features related to customizing the collection's ser/des behavior at a lower level.

Use with caution. See official DataStax documentation for more info.

timeoutDefaults?: Partial<TimeoutDescriptor>
Overview

The default timeout options for any operation performed on this Collection instance.

See TimeoutDescriptor for much more information about timeouts.

Example

// The request timeout for all operations is set to 1000ms.
const client = new DataAPIClient('...', {
  timeoutDefaults: { requestTimeoutMs: 1000 },
});

// The request timeout for all operations borne from this Db is set to 2000ms.
const db = client.db('...', {
  timeoutDefaults: { requestTimeoutMs: 2000 },
});
Inheritance

The timeout options are inherited by all child classes, and can be overridden at any level, including the individual method level.

Individual-method-level overrides can vary in behavior depending on the method; again, see TimeoutDescriptor.

Defaults

The default timeout options are as follows:

  • requestTimeoutMs: 10000
  • generalMethodTimeoutMs: 30000
  • collectionAdminTimeoutMs: 60000
  • tableAdminTimeoutMs: 30000
  • databaseAdminTimeoutMs: 600000
  • keyspaceAdminTimeoutMs: 30000

See

TimeoutDescriptor