Find all databases (TypeScript)
Lists all databases.
|
You need an application token with permission to create and configure databases, such as the Organization Administrator role. For more information, see Get endpoint and token. |
Result
Returns a promise that resolves to a list of FullDatabaseInfo objects that each describe a database.
Signature
Use the listDatabases method, which belongs to the AstraAdmin class.
async listDatabases(
options?: {
include?: AstraDatabaseStatusFilter,
provider?: AstraDatabaseCloudProviderFilter,
limit?: number,
startingAfter?: string,
timeout: number | TimeoutDescriptor,
}): AstraFullDatabaseInfo[]
Parameters
| Name | Type | Summary |
|---|---|---|
|
Optional.
The options for this operation.
See Properties of |
| Name | Type | Summary |
|---|---|---|
|
Optional. Filters the returned databases by status. Can be one of: Some of these status are short-lived or do not apply to Astra DB Serverless databases. Default: |
|
|
Optional. Filters the returned databases by cloud provider. Can be one of: Default: |
|
|
|
Optional. The number of results per page. Maximum: 100 Default: 25 |
|
|
Optional. Pass the database ID of the last item on the previous page to get the next page. |
|
|
Optional. A timeout to impose on each underlying API request. |
Examples
The following examples demonstrate how to list databases.
import { DataAPIClient } from "@datastax/astra-db-ts";
const client = new DataAPIClient("APPLICATION_TOKEN");
const admin = client.admin();
(async function () {
const databases = await admin.listDatabases();
console.log(databases);
})();
Errors
For a full list of Data API error codes and their corresponding messages, see Data API errors and error codes.
For more information about how the client handles underlying Data API errors, see TypeScript client error handling.
Client reference
For more information, see the client reference.