CoolFace
Apppublic

opusdev/vector-similarity-api

sourceHugging Faceupdated 5mo agoView on Hugging Face
1likes
remove_user.ts37 linesDownload Raw Back to operations
1import { type Document } from '../bson';2import { type Connection } from '../cmap/connection';3import { MongoDBResponse } from '../cmap/wire_protocol/responses';4import type { Db } from '../db';5import { CommandOperation, type CommandOperationOptions } from './command';6import { Aspect, defineAspects } from './operation';7 8/** @public */9export type RemoveUserOptions = Omit<CommandOperationOptions, 'rawData'>;10 11/** @internal */12export class RemoveUserOperation extends CommandOperation<boolean> {13  override SERVER_COMMAND_RESPONSE_TYPE = MongoDBResponse;14  override options: RemoveUserOptions;15  username: string;16 17  constructor(db: Db, username: string, options: RemoveUserOptions) {18    super(db, options);19    this.options = options;20    this.username = username;21  }22 23  override get commandName() {24    return 'dropUser' as const;25  }26 27  override buildCommandDocument(_connection: Connection): Document {28    return { dropUser: this.username };29  }30 31  override handleOk(_response: InstanceType<typeof this.SERVER_COMMAND_RESPONSE_TYPE>): boolean {32    return true;33  }34}35 36defineAspects(RemoveUserOperation, [Aspect.WRITE_OPERATION]);37