Uname: Linux business55.web-hosting.com 4.18.0-553.lve.el8.x86_64 #1 SMP Mon May 27 15:27:34 UTC 2024 x86_64
Software: LiteSpeed
PHP version: 8.1.31 [ PHP INFO ] PHP os: Linux
Server Ip: 162.213.251.212
Your Ip: 3.133.134.54
User: allssztx (535) | Group: allssztx (533)
Safe Mode: OFF
Disable Function:
NONE

name : options_operation.ts
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;
  }
}
© 2025 GrazzMean-Shell