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

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

Field

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

See

Db.listCollections

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

Hierarchy (view full)

Properties

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 namespace (aka keyspace) to use for the db operation.