Since 0.1.0
getEntries
Read, validate, and shape every entry in a collection.
Reads every file in the collection, validates each one, and applies the selected view.
const posts = await postCollection.getEntries();
const detailed = await postCollection.getEntries({ view: "detail" });
Signature
collection.getEntries(options?: { view?: ViewName }): Promise<Array<Entry>>;
Parameters
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
options.view | view name | no | "default" | A view declared in views. Unknown names throw |
view is the only accepted option. Passing resolveRelations, filter, or sort throws. An explicit undefined for view is treated as omitted.
Returns
Promise<Array<Entry>>, where Entry is the schema output, _meta (slug, fileName, filePath), resolved relations at the view's depth, and the awaited augment output.
Order is discovery order unless the view has sort. Entries the view's filter rejects are dropped.
Pipeline
- Read and validate every file.
- Resolve relations to the view's depth.
- Run
augment. - Apply
filter. - Apply
sortwithtoSortedsemantics, so ties keep their relative order.
Throws
Unknown view "<name>". Available views: <names>.Getter resolveRelations is no longer supported. Configure it in a view and select that view instead.Getter filter and sort are not supported. Configure them in a collection view instead.- Validation, relation, and augment errors for any entry. See Errors.