diff --git a/src/operations/list_databases.ts b/src/operations/list_databases.ts index d138e35910..5a5ed52927 100644 --- a/src/operations/list_databases.ts +++ b/src/operations/list_databases.ts @@ -7,7 +7,12 @@ import type { Db } from '../db'; import type { ClientSession } from '../sessions'; /** @public */ -export type ListDatabasesResult = string[] | Document[]; +export interface ListDatabasesResult { + databases: ({ name: string; sizeOnDisk?: number; empty?: boolean } & Document)[]; + totalSize?: number; + totalSizeMb?: number; + ok: 1 | 0; +} /** @public */ export interface ListDatabasesOptions extends CommandOperationOptions { diff --git a/test/types/admin.test-d.ts b/test/types/admin.test-d.ts new file mode 100644 index 0000000000..ef76c3fb40 --- /dev/null +++ b/test/types/admin.test-d.ts @@ -0,0 +1,12 @@ +import { expectType } from 'tsd'; +import { Document, MongoClient } from '../../src/index'; + +const client = new MongoClient(''); +const admin = client.db().admin(); + +expectType<{ + databases: ({ name: string; sizeOnDisk?: number; empty?: boolean } & Document)[]; + totalSize?: number; + totalSizeMb?: number; + ok: 1 | 0; +}>(await admin.listDatabases());