1
- import { MongoServerError } from '..' ;
1
+ import { type Connection , MongoServerError } from '..' ;
2
2
import type { Document } from '../bson' ;
3
+ import { MongoDBResponse } from '../cmap/wire_protocol/responses' ;
3
4
import { CursorTimeoutContext } from '../cursor/abstract_cursor' ;
4
5
import type { Db } from '../db' ;
5
6
import { MONGODB_ERROR_CODES } from '../error' ;
6
7
import type { Server } from '../sdam/server' ;
7
8
import type { ClientSession } from '../sessions' ;
8
9
import { TimeoutContext } from '../timeout' ;
9
- import { CommandOperation , type CommandOperationOptions } from './command' ;
10
+ import {
11
+ CommandOperation ,
12
+ type CommandOperationOptions ,
13
+ ModernizedCommandOperation
14
+ } from './command' ;
10
15
import { executeOperation } from './execute_operation' ;
11
16
import { Aspect , defineAspects } from './operation' ;
12
17
@@ -17,7 +22,9 @@ export interface DropCollectionOptions extends CommandOperationOptions {
17
22
}
18
23
19
24
/** @internal */
20
- export class DropCollectionOperation extends CommandOperation < boolean > {
25
+ export class DropCollectionOperation extends ModernizedCommandOperation < boolean > {
26
+ override SERVER_COMMAND_RESPONSE_TYPE = MongoDBResponse ;
27
+
21
28
override options : DropCollectionOptions ;
22
29
name : string ;
23
30
@@ -31,12 +38,11 @@ export class DropCollectionOperation extends CommandOperation<boolean> {
31
38
return 'drop' as const ;
32
39
}
33
40
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 {
40
46
return true ;
41
47
}
42
48
}
0 commit comments