Interface ListCollectionsOptions

Options for listing collections.

Field

nameOnly - If true, only the name of the collection is returned. If false, the full collection info is returned. Defaults to true.

Field

keyspace - Overrides the keyspace to list collections from. If not provided, the default keyspace is used.

Field

maxTimeMS - The maximum amount of time to allow the operation to run.

See

Db.listCollections

interface ListCollectionsOptions {
    keyspace?: string;
    maxTimeMS?: number;
    nameOnly?: boolean;
    namespace?: string;
}

Hierarchy (view full)

Properties

keyspace?: string

The keyspace to use for the operation.

maxTimeMS?: number

The maximum time to wait for a response from the server, in milliseconds.

nameOnly?: boolean

If true, only the name of the collection is returned.

If false, the full collection info is returned.

Defaults to true.

Example

const names = await db.listCollections({ nameOnly: true });
console.log(names); // [{ name: 'my-coll' }]

const info = await db.listCollections({ nameOnly: false });
console.log(info); // [{ name: 'my-coll', options: { ... } }]

Default Value

true
namespace?: string

The keyspace to use for the operation.

This is now a deprecated alias for the strictly equivalent WithKeyspace.keyspace, 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

Deprecated