1
1
import type { Document } from '../bson' ;
2
+ import { type Connection } from '../cmap/connection' ;
3
+ import { MongoDBResponse } from '../cmap/wire_protocol/responses' ;
2
4
import 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' ;
7
6
import { Aspect , defineAspects } from './operation' ;
8
7
9
8
/** @public */
@@ -13,7 +12,8 @@ export interface DbStatsOptions extends CommandOperationOptions {
13
12
}
14
13
15
14
/** @internal */
16
- export class DbStatsOperation extends CommandOperation < Document > {
15
+ export class DbStatsOperation extends ModernizedCommandOperation < Document > {
16
+ override SERVER_COMMAND_RESPONSE_TYPE = MongoDBResponse ;
17
17
override options : DbStatsOptions ;
18
18
19
19
constructor ( db : Db , options : DbStatsOptions ) {
@@ -25,17 +25,12 @@ export class DbStatsOperation extends CommandOperation<Document> {
25
25
return 'dbStats' as const ;
26
26
}
27
27
28
- override async execute (
29
- server : Server ,
30
- session : ClientSession | undefined ,
31
- timeoutContext : TimeoutContext
32
- ) : Promise < Document > {
28
+ override buildCommandDocument ( _connection : Connection ) : Document {
33
29
const command : Document = { dbStats : true } ;
34
30
if ( this . options . scale != null ) {
35
31
command . scale = this . options . scale ;
36
32
}
37
-
38
- return await super . executeCommand ( server , session , command , timeoutContext ) ;
33
+ return command ;
39
34
}
40
35
}
41
36
0 commit comments