Abstract
Abstract
createCreates a new, additional, keyspace for this database.
NB. this is a "long-running" operation. See AdminBlockingOptions about such blocking operations. The default polling interval is 1 second. Expect it to take roughly 8-10 seconds to complete.
The name of the new keyspace.
Optional
options: CreateKeyspaceOptionsThe options for the blocking behavior of the operation.
A promise that resolves when the operation completes.
await dbAdmin.createKeyspace('my_other_keyspace1');
// ['default_keyspace', 'my_other_keyspace1']
console.log(await dbAdmin.listKeyspaces());
await dbAdmin.createKeyspace('my_other_keyspace2', {
blocking: false,
});
// Will not include 'my_other_keyspace2' until the operation completes
console.log(await dbAdmin.listKeyspaces());
Note that if you choose not to block, the created keyspace will not be able to be used until the operation completes, which is up to the caller to determine.
Abstract
createCreates a new, additional, keyspace for this database.
This is now a deprecated alias for the strictly equivalent DbAdmin.createKeyspace, and will be removed in an upcoming major version.
https://docs.datastax.com/en/astra-db-serverless/api-reference/client-versions.html#version-1-5
Optional
options: CreateNamespaceOptionsAbstract
dbGets the underlying Db
object. The options for the db were set when the DbAdmin instance, or whatever spawned
it, was created.
The underlying Db
object.
const dbAdmin = client.admin().dbAdmin('<endpoint>', {
keyspace: 'my-keyspace',
useHttp2: false,
});
const db = dbAdmin.db();
console.log(db.id);
Abstract
dropDrops a keyspace from this database.
NB. this is a "long-running" operation. See AdminBlockingOptions about such blocking operations. The default polling interval is 1 second. Expect it to take roughly 8-10 seconds to complete.
The name of the keyspace to drop.
Optional
options: AdminBlockingOptionsThe options for the blocking behavior of the operation.
A promise that resolves when the operation completes.
await dbAdmin.dropKeyspace('my_other_keyspace1');
// ['default_keyspace', 'my_other_keyspace2']
console.log(await dbAdmin.listKeyspaces());
await dbAdmin.dropKeyspace('my_other_keyspace2', {
blocking: false,
});
// Will still include 'my_other_keyspace2' until the operation completes
// ['default_keyspace', 'my_other_keyspace2']
console.log(await dbAdmin.listKeyspaces());
Note that if you choose not to block, the keyspace will still be able to be used until the operation completes, which is up to the caller to determine.
Abstract
dropDrops a keyspace from this database.
This is now a deprecated alias for the strictly equivalent DbAdmin.dropKeyspace, and will be removed in an upcoming major version.
https://docs.datastax.com/en/astra-db-serverless/api-reference/client-versions.html#version-1-5
Optional
options: AdminBlockingOptionsAbstract
findReturns detailed information about the availability and usage of the vectorize embedding providers available on the current database (may vary based on cloud provider & region).
Optional
options: WithTimeoutThe options for the timeout of the operation.
The available embedding providers.
const { embeddingProviders } = await dbAdmin.findEmbeddingProviders();
// ['text-embedding-3-small', 'text-embedding-3-large', 'text-embedding-ada-002']
console.log(embeddingProviders['openai'].models.map(m => m.name));
Abstract
listRetrieves a list of all the keyspaces in the database.
Semantic order is not guaranteed, but implementations are free to assign one. AstraDbAdmin, for example, always has the first keyspace in the array be the default one.
A promise that resolves to list of all the keyspaces in the database.
const keyspaces = await dbAdmin.listKeyspaces();
// ['default_keyspace', 'my_other_keyspace']
console.log(keyspaces);
Abstract
listRetrieves a list of all the keyspaces in the database.
Creates a new, additional, keyspace for this database.
This is now a deprecated alias for the strictly equivalent DbAdmin.listKeyspaces, and will be removed in an upcoming major version.
Represents some DatabaseAdmin class used for managing some specific database.
This abstract version lists the core functionalities that any database admin class may have, but subclasses may have additional methods or properties (e.g. AstraDbAdmin).
Use Db.admin or AstraAdmin.dbAdmin to obtain an instance of this class.