Server IP : 162.213.251.212 / Your IP : 3.145.6.179 [ Web Server : LiteSpeed System : 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 User : allssztx ( 535) PHP Version : 8.1.31 Disable Function : NONE Domains : 1 Domains MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /proc/self/root/home/allssztx/needapair.com/node_modules/mongodb/src/operations/ |
Upload File : |
import { Collection } from '../collection'; import type { Db } from '../db'; import type { Server } from '../sdam/server'; import type { ClientSession } from '../sessions'; import { AbstractOperation, type OperationOptions } from './operation'; export interface CollectionsOptions extends OperationOptions { nameOnly?: boolean; } /** @internal */ export class CollectionsOperation extends AbstractOperation<Collection[]> { override options: CollectionsOptions; db: Db; constructor(db: Db, options: CollectionsOptions) { super(options); this.options = options; this.db = db; } override get commandName() { return 'listCollections' as const; } override async execute( server: Server, session: ClientSession | undefined ): Promise<Collection[]> { // Let's get the collection names const documents = await this.db .listCollections( {}, { ...this.options, nameOnly: true, readPreference: this.readPreference, session } ) .toArray(); const collections: Collection[] = []; for (const { name } of documents) { if (!name.includes('$')) { // Filter collections removing any illegal ones collections.push(new Collection(this.db, name, this.db.s.options)); } } // Return the collection objects return collections; } }