Interface CreateCollectionOptions<Schema>

Options for creating a new collection (via Db.createCollection).

See Db.createCollection & Collection for more information.

Field

vector - The vector configuration for the collections.

Field

indexing - The indexing configuration for the collections.

Field

defaultId - The default ID for the collections.

Field

keyspace - Overrides the keyspace for the collections.

Field

timeout - The timeout override for this method

See

Db.createCollection

interface CreateCollectionOptions<Schema> {
    checkExists?: "ERROR: `checkExists` has been removed. It is equivalent to being always `false` now.";
    defaultId?: CollectionDefaultIdOptions;
    defaultMaxTimeMS?: "ERROR: The `defaultMaxTimeMS` option is no longer available here; the timeouts system has been overhauled, and defaults should now be set using the `timeoutDefaults` option";
    embeddingApiKey?: string | EmbeddingHeadersProvider;
    indexing?: CollectionIndexingOptions<Schema>;
    keyspace?: string;
    lexical?: CollectionLexicalOptions;
    logging?: LoggingConfig;
    maxTimeMS?: "ERROR: The `maxTimeMS` option is no longer available here; the timeouts system has been overhauled, and defaults should now be set using the `timeoutDefaults` option";
    namespace?: "ERROR: The `namespace` terminology has been removed, and replaced with `keyspace` throughout the client";
    rerank?: CollectionRerankOptions;
    rerankingApiKey?: string | RerankingHeadersProvider;
    serdes?: CollectionSerDesConfig;
    timeout?: number | Pick<Partial<TimeoutDescriptor>, "collectionAdminTimeoutMs">;
    timeoutDefaults?: Partial<TimeoutDescriptor>;
    vector?: CollectionVectorOptions;
}

Type Parameters

Hierarchy (view full)

Properties

checkExists?: "ERROR: `checkExists` has been removed. It is equivalent to being always `false` now."

This temporary error-ing property exists for migration convenience, and will be removed in a future version.

Deprecated

  • The client-side checkExists option has been removed due to it being unnecessary and prone to check-then-act race conditions. createCollection is a no-op if a collection is created with the same options; it will however still throw an error if the options differ.

Options related to the default ID.

defaultMaxTimeMS?: "ERROR: The `defaultMaxTimeMS` option is no longer available here; the timeouts system has been overhauled, and defaults should now be set using the `timeoutDefaults` option"

This temporary error-ing property exists for migration convenience, and will be removed in a future version.

Deprecated

  • The defaultMaxTimeMS option is no longer available here; the timeouts system has been overhauled, and defaults should now be set using the timeoutDefaults option.
embeddingApiKey?: 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).

Options related to indexing.

keyspace?: string

The keyspace to use for the operation.

Options related to lexical (bm25) search.

logging?: LoggingConfig

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 LoggingConfig for much more information on configuration, outputs, and inheritance.

maxTimeMS?: "ERROR: The `maxTimeMS` option is no longer available here; the timeouts system has been overhauled, and defaults should now be set using the `timeoutDefaults` option"

This temporary error-ing property exists for migration convenience, and will be removed in a future version.

Deprecated

  • The maxTimeMS option is no longer available here; the timeouts system has been overhauled, and defaults should now be set using the timeoutDefaults option.
namespace?: "ERROR: The `namespace` terminology has been removed, and replaced with `keyspace` throughout the client"

This temporary error-ing property exists for migration convenience, and will be removed in a future version.

Deprecated

  • The namespace terminology has been removed, and replaced with keyspace throughout the client.

Options related to reranking.

rerankingApiKey?: string | RerankingHeadersProvider

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

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.

timeout?: number | Pick<Partial<TimeoutDescriptor>, "collectionAdminTimeoutMs">
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: 15000
  • generalMethodTimeoutMs: 30000
  • collectionAdminTimeoutMs: 60000
  • tableAdminTimeoutMs: 30000
  • databaseAdminTimeoutMs: 600000
  • keyspaceAdminTimeoutMs: 30000

See

TimeoutDescriptor

Options related to vector search.