EveryDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/alineacms/alinea/llms.txt
Use this file to discover all available pages before exploring further.
cms.find(), cms.get(), cms.first(), and cms.count() call accepts a filter key alongside the optional orderBy, take, and skip keys. Together these let you retrieve precisely the entries you need without post-processing in JavaScript.
The filter object
The filter key accepts a Filter<Fields> value — a plain object whose keys match the fields of the content type you are querying. Each value is either a direct match (equality) or a condition object that names the operator.
Custom type fields use their bare name (e.g. slug, title, publishDate). Alinea’s built-in entry meta-fields — _id, _type, _status, _parentId, _locale, _path, _url — use an underscore prefix in the filter object.
app/blog/page.tsx
Scalar condition operators
Forstring, number, boolean, and null fields, the following operators are available:
| Operator | Description |
|---|---|
is | Exact equality |
isNot | Not equal |
in | Value is in the array |
notIn | Value is not in the array |
gt | Greater than |
gte | Greater than or equal |
lt | Less than |
lte | Less than or equal |
startsWith | String starts with the given prefix |
Scalar filter examples
Array field operators
For array-typed fields, useincludes to test whether the array contains an item that matches the inner condition:
Object field operators
For nested object fields, usehas to filter on the nested shape:
Combining conditions with and / or
Multiple field conditions inside a single filter object are implicitly combined with AND. Use the top-level and or or keys to compose explicit boolean logic.
Combining conditions
and and or accept arrays of Filter objects. Passing undefined in the array is safe — Alinea ignores undefined entries, so you can conditionally include conditions without extra null-checks.Top-level shorthand filters
In addition to thefilter key, several entry-level fields can be filtered directly on the query object itself:
Condition object using any of the operators listed above.
Ordering results
TheorderBy key accepts a single Order object or an array of them. Each Order is either {asc: Expr} or {desc: Expr}, where the expression is a field reference from your type or from Query.*.
Ordering examples
Pagination with take and skip
Use take to limit the number of results and skip to offset the window. This maps directly to SQL LIMIT / OFFSET.
app/blog/page.tsx
Return at most this many results.
Skip this many results from the beginning of the result set.
Projecting with select
Adding a select object limits which fields are deserialised and returned. This is purely a performance and type-narrowing tool — it does not affect query execution time for the filter itself, but it reduces the amount of data transferred from the in-memory database to your component.
Selective projection
Full-text search with search and Query.snippet()
Pass search to execute a full-text search across all searchable fields of the queried type. Combine it with Query.snippet() in your select to include a highlighted excerpt in the results.
Full-text search
Query.snippet() accepts four optional parameters:
Custom snippet delimiters
Full-text search works over the
searchableText index that Alinea builds at generate time. Fields are included in this index when they are marked as searchable in the field definition (the default for Field.text and Field.richText).