Interface ListCollectionsOptions

Options for listing collections.

Field

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

Field

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

Field

timeout - The timeout override for this method

See

Db.listCollections

interface ListCollectionsOptions {
    keyspace?: string;
    maxTimeMS?: "ERROR: The `maxTimeMS` option is no longer available; the timeouts system has been overhauled, and timeouts should now be set using `timeout`";
    nameOnly?: boolean;
    namespace?: "ERROR: The `namespace` terminology has been removed, and replaced with `keyspace` throughout the client";
    timeout?: number | Pick<Partial<TimeoutDescriptor>, "requestTimeoutMs" | "collectionAdminTimeoutMs">;
}

Hierarchy (view full)

Properties

keyspace?: string

The keyspace to use for the operation.

maxTimeMS?: "ERROR: The `maxTimeMS` option is no longer available; the timeouts system has been overhauled, and timeouts should now be set using `timeout`"

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

Deprecated

  • The maxTimeMS option is no longer available; the timeouts system has been overhauled, and timeouts should now be set using timeout, and defaults in timeoutDefaults. You may generally Ctrl+R replace maxTimeMS with timeout to retain the same behavior.
nameOnly?: boolean

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

If false, the full collections 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?: "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.
timeout?: number | Pick<Partial<TimeoutDescriptor>, "requestTimeoutMs" | "collectionAdminTimeoutMs">

The method timeout override.

See TimeoutDescriptor for much more information.