1- import { MongoServerError } from '..' ;
1+ import { type Connection , MongoServerError } from '..' ;
22import type { Document } from '../bson' ;
3+ import { MongoDBResponse } from '../cmap/wire_protocol/responses' ;
34import { CursorTimeoutContext } from '../cursor/abstract_cursor' ;
45import type { Db } from '../db' ;
56import { MONGODB_ERROR_CODES } from '../error' ;
67import type { Server } from '../sdam/server' ;
78import type { ClientSession } from '../sessions' ;
89import { TimeoutContext } from '../timeout' ;
9- import { CommandOperation , type CommandOperationOptions } from './command' ;
10+ import {
11+ CommandOperation ,
12+ type CommandOperationOptions ,
13+ ModernizedCommandOperation
14+ } from './command' ;
1015import { executeOperation } from './execute_operation' ;
1116import { Aspect , defineAspects } from './operation' ;
1217
@@ -17,7 +22,9 @@ export interface DropCollectionOptions extends CommandOperationOptions {
1722}
1823
1924/** @internal */
20- export class DropCollectionOperation extends CommandOperation < boolean > {
25+ export class DropCollectionOperation extends ModernizedCommandOperation < boolean > {
26+ override SERVER_COMMAND_RESPONSE_TYPE = MongoDBResponse ;
27+
2128 override options : DropCollectionOptions ;
2229 name : string ;
2330
@@ -31,12 +38,11 @@ export class DropCollectionOperation extends CommandOperation<boolean> {
3138 return 'drop' as const ;
3239 }
3340
34- override async execute (
35- server : Server ,
36- session : ClientSession | undefined ,
37- timeoutContext : TimeoutContext
38- ) : Promise < boolean > {
39- await super . executeCommand ( server , session , { drop : this . name } , timeoutContext ) ;
41+ override buildCommandDocument ( _connection : Connection , _session ?: ClientSession ) : Document {
42+ return { drop : this . name } ;
43+ }
44+
45+ override handleOk ( _response : InstanceType < typeof this . SERVER_COMMAND_RESPONSE_TYPE > ) : boolean {
4046 return true ;
4147 }
4248}
0 commit comments