Spaces:
Runtime error
Runtime error
Download static/node_modules/mongodb/src/operations/profiling_level.ts from kaab4321/NarrativeFlow: direct link, hf CLI and curl.
- Browser
- Download file 1.19 kB
-
https://huggingface.co/spaces/kaab4321/NarrativeFlow/resolve/main/static/node_modules/mongodb/src/operations/profiling_level.ts
- Command line
-
hf download hf://spaces/kaab4321/NarrativeFlow/static/node_modules/mongodb/src/operations/profiling_level.ts
-
curl -L -o profiling_level.ts https://huggingface.co/spaces/kaab4321/NarrativeFlow/resolve/main/static/node_modules/mongodb/src/operations/profiling_level.ts
1.19 kB
| import type { Db } from '../db'; | |
| import { MongoUnexpectedServerResponseError } from '../error'; | |
| import type { Server } from '../sdam/server'; | |
| import type { ClientSession } from '../sessions'; | |
| import { CommandOperation, type CommandOperationOptions } from './command'; | |
| /** @public */ | |
| export type ProfilingLevelOptions = CommandOperationOptions; | |
| /** @internal */ | |
| export class ProfilingLevelOperation extends CommandOperation<string> { | |
| override options: ProfilingLevelOptions; | |
| constructor(db: Db, options: ProfilingLevelOptions) { | |
| super(db, options); | |
| this.options = options; | |
| } | |
| override get commandName() { | |
| return 'profile' as const; | |
| } | |
| override async execute(server: Server, session: ClientSession | undefined): Promise<string> { | |
| const doc = await super.executeCommand(server, session, { profile: -1 }); | |
| if (doc.ok === 1) { | |
| const was = doc.was; | |
| if (was === 0) return 'off'; | |
| if (was === 1) return 'slow_only'; | |
| if (was === 2) return 'all'; | |
| throw new MongoUnexpectedServerResponseError(`Illegal profiling level value ${was}`); | |
| } else { | |
| throw new MongoUnexpectedServerResponseError('Error with profile command'); | |
| } | |
| } | |
| } | |