* Checks if one or more indexes exist on the collection, fails on first non-existing index * * @param indexes - One or more index names to check. * @param options - Optional settings for the command
(indexes: string | string[], options?: ListIndexesOptions)
| 747 | * @param options - Optional settings for the command |
| 748 | */ |
| 749 | async indexExists(indexes: string | string[], options?: ListIndexesOptions): Promise<boolean> { |
| 750 | const indexNames: string[] = Array.isArray(indexes) ? indexes : [indexes]; |
| 751 | const allIndexes: Set<string> = new Set( |
| 752 | await this.listIndexes(options) |
| 753 | .map(({ name }) => name) |
| 754 | .toArray() |
| 755 | ); |
| 756 | return indexNames.every(name => allIndexes.has(name)); |
| 757 | } |
| 758 | |
| 759 | /** |
| 760 | * Retrieves this collections index info. |
no test coverage detected