Interface WithNamespace

Allows you to override the namespace (aka keyspace) to use for some db operation. If not specified, the db operation will use either the namespace provided when creating the Db instance, the namespace provided when creating the DataAPIClient instance, or the default namespace 'default_keyspace'. (in that order)

Example

const client = new DataAPIClient('AstraCS:...');

// Using 'default_keyspace' as the namespace
const db1 = client.db('https://<db_id>-<region>.apps.astra.datastax.com');

// Using 'my_namespace' as the namespace
const db2 = client.db('https://<db_id>-<region>.apps.astra.datastax.com', {
  namespace: 'my_keyspace',
});

// Finds 'my_collection' in 'default_keyspace'
const coll1 = db1.collection('my_collection');

// Finds 'my_collection' in 'my_namespace'
const coll2 = db1.collection('my_collection', {
  namespace: 'my_namespace',
});

Field

namespace - The namespace (aka keyspace) to use for the db operation.

interface WithNamespace {
    namespace?: string;
}

Hierarchy (view full)

Properties

Properties

namespace?: string

The namespace (aka keyspace) to use for the db operation.