Interface WithKeyspace

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

Example

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

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

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

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

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

Field

keyspace - The keyspace to use for the db operation.

interface WithKeyspace {
    keyspace?: string;
    namespace?: "ERROR: The `namespace` terminology has been removed, and replaced with `keyspace` throughout the client";
}

Hierarchy (view full)

Properties

keyspace?: string

The keyspace to use for the operation.

namespace?: "ERROR: The `namespace` terminology has been removed, and replaced with `keyspace` throughout the client"

This temporary error-ing property exists for migration convenience, and will be removed in a future version.

Deprecated

  • The namespace terminology has been removed, and replaced with keyspace throughout the client.