Skip to content

Since 0.3.0

getEntries

Read, validate, and shape every entry in a collection.

View Markdown
On this page

Reads every file in the collection, validates each one, and applies the selected view.

src/app/posts/page.tsx
const posts = await postCollection.getEntries();
const detailed = await postCollection.getEntries({ view: "detail" });

Signature

@qino/cms
collection.getEntries(options?: { view?: ViewName }): Promise<Array<Entry>>;

Parameters

view is the only accepted option. Passing resolveDepth, 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), relations resolved to the view's depths, and the awaited augment output.

Order is slug order unless the view has sort. Entries the view's filter rejects are dropped. For long listings, read one page at a time with getPaginatedEntries.

Pipeline

  1. Read and validate every file.
  2. Resolve relations to the view's depths.
  3. Run augment.
  4. Apply filter.
  5. Apply sort with toSorted semantics, so ties keep their slug order.

Throws

  • Unknown view "<name>". Available views: <names>.
  • Getter resolveDepth is not supported. Configure resolveDepth 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.

See also