Context.traverseCollection(collection: Collection,options?: TraverseCollectionOptions,): AsyncIterable<Object | Link>
Traverses a collection, yielding each item in the collection. If the collection is paginated, it will fetch the next page automatically.
Example 1
Example 1
const collection = await ctx.lookupObject(collectionUrl); if (collection instanceof Collection) { for await (const item of ctx.traverseCollection(collection)) { console.log(item.id?.href); } }
It's almost the same as the traverseCollection function, but it uses the context's document loader and context loader by default.
collection: Collection
The collection to traverse.
optional
options: TraverseCollectionOptions
Options for traversing the collection.