MCPcopy
hub / github.com/mongodb/node-mongodb-native / collections

Method collections

src/db.ts:431–441  ·  view source on GitHub ↗

* Fetch all collections for the current db. * * @param options - Optional settings for the command

(options?: ListCollectionsOptions)

Source from the content-addressed store, hash-verified

429 * @param options - Optional settings for the command
430 */
431 async collections(options?: ListCollectionsOptions): Promise<Collection[]> {
432 options = resolveOptions(this, options);
433 const collections = await this.listCollections({}, { ...options, nameOnly: true }).toArray();
434
435 return collections
436 .filter(
437 // Filter collections removing any illegal ones
438 ({ name }) => !name.includes('$')
439 )
440 .map(({ name }) => new Collection(this, name, this.s.options));
441 }
442
443 /**
444 * Creates an index on the db and collection.

Callers 6

gridfs.test.tsFile · 0.80
collection.test.tsFile · 0.80
db.test.tsFile · 0.80

Calls 5

listCollectionsMethod · 0.95
resolveOptionsFunction · 0.90
toArrayMethod · 0.80
mapMethod · 0.45
filterMethod · 0.45

Tested by

no test coverage detected