Interface CreateDataAPIKeyspaceOptions

Represents the options for creating a keyspace on a non-Astra database (i.e. blocking options + keyspace creation options).

If no replication options are provided, it will default to 'SimpleStrategy' with a replication factor of 1.

See AstraAdminBlockingOptions for more options about blocking behavior.

If updateDbKeyspace is set to true, the underlying Db instance used to create the DbAdmin will have its current working keyspace set to the newly created keyspace immediately (even if the keyspace isn't technically yet created).

Example

// If using non-astra, this may be a common idiom:
const client = new DataAPIClient({ environment: 'dse' });
const db = client.db('<endpoint>', { token: '<token>' });

// Will internally call `db.useKeyspace('new_keyspace')`
await db.admin().createKeyspace('new_keyspace', {
  updateDbKeyspace: true,
});

// Creates collections in keyspace `new_keyspace` by default now
const coll = db.createCollection('my_coll');
interface CreateDataAPIKeyspaceOptions {
    maxTimeMS?: "ERROR: The `maxTimeMS` option is no longer available; the timeouts system has been overhauled, and timeouts should now be set using `timeout`";
    replication?: KeyspaceReplicationOptions;
    timeout?: number | Pick<Partial<TimeoutDescriptor>, "requestTimeoutMs" | "keyspaceAdminTimeoutMs">;
    updateDbKeyspace?: boolean;
}

Hierarchy (view full)

  • WithTimeout<"keyspaceAdminTimeoutMs">
    • CreateDataAPIKeyspaceOptions

Properties

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

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; the timeouts system has been overhauled, and timeouts should now be set using timeout, and defaults in timeoutDefaults. You may generally Ctrl+R replace maxTimeMS with timeout to retain the same behavior.
timeout?: number | Pick<Partial<TimeoutDescriptor>, "requestTimeoutMs" | "keyspaceAdminTimeoutMs">

The method timeout override.

See TimeoutDescriptor for much more information.

updateDbKeyspace?: boolean