-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Expand file tree
/
Copy pathremove_user.ts
More file actions
36 lines (29 loc) · 1.12 KB
/
remove_user.ts
File metadata and controls
36 lines (29 loc) · 1.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import { type Document } from '../bson';
import { type Connection } from '../cmap/connection';
import { MongoDBResponse } from '../cmap/wire_protocol/responses';
import type { Db } from '../db';
import { type CommandOperationOptions, ModernizedCommandOperation } from './command';
import { Aspect, defineAspects } from './operation';
/** @public */
export type RemoveUserOptions = CommandOperationOptions;
/** @internal */
export class RemoveUserOperation extends ModernizedCommandOperation<boolean> {
override SERVER_COMMAND_RESPONSE_TYPE = MongoDBResponse;
override options: RemoveUserOptions;
username: string;
constructor(db: Db, username: string, options: RemoveUserOptions) {
super(db, options);
this.options = options;
this.username = username;
}
override get commandName() {
return 'dropUser' as const;
}
override buildCommandDocument(_connection: Connection): Document {
return { dropUser: this.username };
}
override handleOk(_response: InstanceType<typeof this.SERVER_COMMAND_RESPONSE_TYPE>): boolean {
return true;
}
}
defineAspects(RemoveUserOperation, [Aspect.WRITE_OPERATION]);