@@ -4,14 +4,9 @@ import { MongoDBResponse } from '../cmap/wire_protocol/responses';
44import { CursorTimeoutContext } from '../cursor/abstract_cursor' ;
55import type { Db } from '../db' ;
66import { MONGODB_ERROR_CODES } from '../error' ;
7- import type { Server } from '../sdam/server' ;
87import type { ClientSession } from '../sessions' ;
98import { TimeoutContext } from '../timeout' ;
10- import {
11- CommandOperation ,
12- type CommandOperationOptions ,
13- ModernizedCommandOperation
14- } from './command' ;
9+ import { type CommandOperationOptions , ModernizedCommandOperation } from './command' ;
1510import { executeOperation } from './execute_operation' ;
1611import { Aspect , defineAspects } from './operation' ;
1712
@@ -112,7 +107,8 @@ export async function dropCollections(
112107export type DropDatabaseOptions = CommandOperationOptions ;
113108
114109/** @internal */
115- export class DropDatabaseOperation extends CommandOperation < boolean > {
110+ export class DropDatabaseOperation extends ModernizedCommandOperation < boolean > {
111+ override SERVER_COMMAND_RESPONSE_TYPE = MongoDBResponse ;
116112 override options : DropDatabaseOptions ;
117113
118114 constructor ( db : Db , options : DropDatabaseOptions ) {
@@ -123,12 +119,11 @@ export class DropDatabaseOperation extends CommandOperation<boolean> {
123119 return 'dropDatabase' as const ;
124120 }
125121
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 {
132127 return true ;
133128 }
134129}
0 commit comments