@@ -4,14 +4,9 @@ import { MongoDBResponse } from '../cmap/wire_protocol/responses';
4
4
import { CursorTimeoutContext } from '../cursor/abstract_cursor' ;
5
5
import type { Db } from '../db' ;
6
6
import { MONGODB_ERROR_CODES } from '../error' ;
7
- import type { Server } from '../sdam/server' ;
8
7
import type { ClientSession } from '../sessions' ;
9
8
import { TimeoutContext } from '../timeout' ;
10
- import {
11
- CommandOperation ,
12
- type CommandOperationOptions ,
13
- ModernizedCommandOperation
14
- } from './command' ;
9
+ import { type CommandOperationOptions , ModernizedCommandOperation } from './command' ;
15
10
import { executeOperation } from './execute_operation' ;
16
11
import { Aspect , defineAspects } from './operation' ;
17
12
@@ -112,7 +107,8 @@ export async function dropCollections(
112
107
export type DropDatabaseOptions = CommandOperationOptions ;
113
108
114
109
/** @internal */
115
- export class DropDatabaseOperation extends CommandOperation < boolean > {
110
+ export class DropDatabaseOperation extends ModernizedCommandOperation < boolean > {
111
+ override SERVER_COMMAND_RESPONSE_TYPE = MongoDBResponse ;
116
112
override options : DropDatabaseOptions ;
117
113
118
114
constructor ( db : Db , options : DropDatabaseOptions ) {
@@ -123,12 +119,11 @@ export class DropDatabaseOperation extends CommandOperation<boolean> {
123
119
return 'dropDatabase' as const ;
124
120
}
125
121
126
- override async execute (
127
- server : Server ,
128
- session : ClientSession | undefined ,
129
- timeoutContext : TimeoutContext
130
- ) : Promise < boolean > {
131
- await super . executeCommand ( server , session , { dropDatabase : 1 } , timeoutContext ) ;
122
+ override buildCommandDocument ( _connection : Connection , _session ?: ClientSession ) : Document {
123
+ return { dropDatabase : 1 } ;
124
+ }
125
+
126
+ override handleOk ( _response : InstanceType < typeof this . SERVER_COMMAND_RESPONSE_TYPE > ) : boolean {
132
127
return true ;
133
128
}
134
129
}
0 commit comments