Skip to content

Commit 8e83105

Browse files
committed
Add support for withHidden in collection.indexes
1 parent 8e48d93 commit 8e83105

File tree

2 files changed

+27
-3
lines changed

2 files changed

+27
-3
lines changed

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,13 @@ This driver uses semantic versioning:
2222

2323
Inlining this dependency should help make arangojs more portable.
2424

25+
### Added
26+
27+
- Added support for `withHidden` option in `collection.indexes`
28+
29+
This option was introduced in ArangoDB 3.10.13 and 3.11.7 and allows
30+
fetching the progress information of indexes that are in the building phase.
31+
2532
## [9.0.0-preview.1]
2633

2734
This is a major release and breaks backwards compatibility.

src/collection.ts

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)