Interface CreateCollectionOptions<Schema>

Options for creating a new collection.

Field

vector - The vector configuration for the collection.

Field

indexing - The indexing configuration for the collection.

Field

defaultId - The default ID for the collection.

Field

keyspace - Overrides the keyspace for the collection.

Field

maxTimeMS - The maximum time to allow the operation to run.

Field

checkExists - Whether to check if the collection exists before creating it.

See

Db.createCollection

interface CreateCollectionOptions<Schema> {
    checkExists?: boolean;
    defaultId?: DefaultIdOptions;
    defaultMaxTimeMS?: null | number;
    embeddingApiKey?: null | string | EmbeddingHeadersProvider;
    indexing?: IndexingOptions<Schema>;
    keyspace?: string;
    maxTimeMS?: number;
    namespace?: string;
    vector?: VectorOptions;
}

Type Parameters

Hierarchy (view full)

Properties

checkExists?: boolean

If true or unset, runs an additional existence check before creating the collection, failing if the collection with the same name already exists, raising a CollectionAlreadyExistsError.

Otherwise, if false, the creation is always attempted, and the command will succeed even if the collection with the given name already exists, as long as the options are the exact same (if options mismatch, it'll throw a DataAPIResponseError).

Default Value

true
defaultId?: DefaultIdOptions

Options related to the default ID.

defaultMaxTimeMS?: null | number

The default maxTimeMS for all operations on the collection. Will override the maxTimeMS set in the DataAPIClient options; it can be overridden on a per-operation basis.

This does not mean the request will be cancelled after this time, but rather that the client will wait for this time before considering the request to have timed out.

The request may or may not still be running on the server after this time.

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).

Options related to indexing.

keyspace?: string

The keyspace to use for the operation.

maxTimeMS?: number

The maximum time to wait for a response from the server, in milliseconds.

namespace?: string

The keyspace to use for the operation.

This is now a deprecated alias for the strictly equivalent WithKeyspace.keyspace, and will be removed in an upcoming major version.

https://docs.datastax.com/en/astra-db-serverless/api-reference/client-versions.html#version-1-5

Deprecated

vector?: VectorOptions

Options related to vector search.