@@ -2561,14 +2561,31 @@ export interface DocumentCollection<T extends Record<string, any> = any>
25612561 /**
25622562 * Returns a list of all index descriptions for the collection.
25632563 *
2564+ * @param withHidden - If set to `true`, includes indexes that are not yet
2565+ * fully built but are in the building phase. Default: `false`.
2566+ *
25642567 * @example
25652568 * ```js
25662569 * const db = new Database();
25672570 * const collection = db.collection("some-collection");
25682571 * const indexes = await collection.indexes();
25692572 * ```
25702573 */
2571- indexes ( ) : Promise < Index [ ] > ;
2574+ indexes ( withHidden ?: boolean ) : Promise < Index [ ] > ;
2575+ /**
2576+ * Returns a list of all index descriptions for the collection.
2577+ *
2578+ * @param withHidden - If set to `true`, includes indexes that are not yet
2579+ * fully built but are in the building phase. Default: `false`.
2580+ *
2581+ * @example
2582+ * ```js
2583+ * const db = new Database();
2584+ * const collection = db.collection("some-collection");
2585+ * const indexes = await collection.indexes(true);
2586+ * ```
2587+ */
2588+ indexes ( withHidden ?: boolean ) : Promise < ( Index & { progress : number } ) [ ] > ;
25722589 /**
25732590 * Returns an index description by name or `id` if it exists.
25742591 *
@@ -4161,11 +4178,11 @@ export class Collection<T extends Record<string, any> = any>
41614178 //#endregion
41624179
41634180 //#region indexes
4164- indexes ( ) {
4181+ indexes ( withHidden = false ) {
41654182 return this . _db . request (
41664183 {
41674184 path : "/_api/index" ,
4168- search : { collection : this . _name } ,
4185+ search : { collection : this . _name , withHidden : String ( withHidden ) } ,
41694186 } ,
41704187 ( res ) => res . parsedBody . indexes
41714188 ) ;
0 commit comments