Spaces:
Runtime error
Runtime error
Download static/node_modules/mongodb/src/operations/options_operation.ts from kaab4321/NarrativeFlow: direct link, hf CLI and curl.
- Browser
- Download file 1.21 kB
-
https://huggingface.co/spaces/kaab4321/NarrativeFlow/resolve/main/static/node_modules/mongodb/src/operations/options_operation.ts
- Command line
-
hf download hf://spaces/kaab4321/NarrativeFlow/static/node_modules/mongodb/src/operations/options_operation.ts
-
curl -L -o options_operation.ts https://huggingface.co/spaces/kaab4321/NarrativeFlow/resolve/main/static/node_modules/mongodb/src/operations/options_operation.ts
1.21 kB
| import type { Document } from '../bson'; | |
| import type { Collection } from '../collection'; | |
| import { MongoAPIError } from '../error'; | |
| import type { Server } from '../sdam/server'; | |
| import type { ClientSession } from '../sessions'; | |
| import { AbstractOperation, type OperationOptions } from './operation'; | |
| /** @internal */ | |
| export class OptionsOperation extends AbstractOperation<Document> { | |
| override options: OperationOptions; | |
| collection: Collection; | |
| constructor(collection: Collection, options: OperationOptions) { | |
| super(options); | |
| this.options = options; | |
| this.collection = collection; | |
| } | |
| override get commandName() { | |
| return 'listCollections' as const; | |
| } | |
| override async execute(server: Server, session: ClientSession | undefined): Promise<Document> { | |
| const coll = this.collection; | |
| const [collection] = await coll.s.db | |
| .listCollections( | |
| { name: coll.collectionName }, | |
| { ...this.options, nameOnly: false, readPreference: this.readPreference, session } | |
| ) | |
| .toArray(); | |
| if (collection == null || collection.options == null) { | |
| throw new MongoAPIError(`collection ${coll.namespace} not found`); | |
| } | |
| return collection.options; | |
| } | |
| } | |