11import type { Document } from '../bson' ;
2+ import { type Connection } from '../cmap/connection' ;
3+ import { MongoDBResponse } from '../cmap/wire_protocol/responses' ;
24import type { Db } from '../db' ;
3- import type { Server } from '../sdam/server' ;
4- import type { ClientSession } from '../sessions' ;
5- import { type TimeoutContext } from '../timeout' ;
6- import { CommandOperation , type CommandOperationOptions } from './command' ;
5+ import { type CommandOperationOptions , ModernizedCommandOperation } from './command' ;
76import { Aspect , defineAspects } from './operation' ;
87
98/** @public */
@@ -13,7 +12,8 @@ export interface DbStatsOptions extends CommandOperationOptions {
1312}
1413
1514/** @internal */
16- export class DbStatsOperation extends CommandOperation < Document > {
15+ export class DbStatsOperation extends ModernizedCommandOperation < Document > {
16+ override SERVER_COMMAND_RESPONSE_TYPE = MongoDBResponse ;
1717 override options : DbStatsOptions ;
1818
1919 constructor ( db : Db , options : DbStatsOptions ) {
@@ -25,17 +25,12 @@ export class DbStatsOperation extends CommandOperation<Document> {
2525 return 'dbStats' as const ;
2626 }
2727
28- override async execute (
29- server : Server ,
30- session : ClientSession | undefined ,
31- timeoutContext : TimeoutContext
32- ) : Promise < Document > {
28+ override buildCommandDocument ( _connection : Connection ) : Document {
3329 const command : Document = { dbStats : true } ;
3430 if ( this . options . scale != null ) {
3531 command . scale = this . options . scale ;
3632 }
37-
38- return await super . executeCommand ( server , session , command , timeoutContext ) ;
33+ return command ;
3934 }
4035}
4136
0 commit comments