Type alias CreateNamespaceOptions

CreateNamespaceOptions: AdminBlockingOptions & {
    updateDbNamespace?: boolean;
}

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

See AdminBlockingOptions for more options about blocking behavior.

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

Type declaration

  • Optional updateDbNamespace?: 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.useNamespace('new_namespace')`
await db.admin().createNamespace('new_namespace', {
  updateDbNamespace: true,
});

// Creates collection in namespace `new_namespace` by default now
const coll = db.createCollection('my_coll');