Type alias AstraCreateKeyspaceOptions

AstraCreateKeyspaceOptions: AstraAdminBlockingOptions & WithTimeout<"keyspaceAdminTimeoutMs"> & {
    updateDbKeyspace?: boolean;
}

Represents the common options for creating a keyspace through the astra-db-ts client.

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

Type declaration

  • Optional updateDbKeyspace?: boolean

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');

See

DbAdmin.createKeyspace