* Fetch all collections for the current db. * * @param options - Optional settings for the command
(options?: ListCollectionsOptions)
| 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. |
no test coverage detected