Reading nodes
A row is a db.Node<T>: the node's properties, and system fields whose names start with $:
| Field | Is |
|---|---|
$id |
the node's id |
$type |
the CodeName of its concrete type, also in a query over a base type |
$displayName |
the name lists show |
$createdUtc, $changedUtc |
Dates; $changedUtc is the last save that changed the node's values |
A relation end is in a row only when the query includes it, so product.Parent does not compile
without include(). References read as ids, files as a FileValue with its url, and HTML with its
internal links as URLs.
| Method | Returns |
|---|---|
get<T>(id) |
the node, or null when it does not exist or the user cannot read it |
getMany<T>(ids) |
the nodes the user can read, in the order asked for |
exists(id) |
whether the node exists and the user can read it |
count(type?) |
how many nodes of the type and its subtypes the user can read; without a type, all nodes |
getRelated(type, id, end) |
the related nodes the user can read, in the relation end's order |
getUrl(id), parseUrl(url) |
the node's URL; the page a URL points to, as { id, culture }, or null |
fileUrl(id, property, adjustment?) |
a file's URL, or the URL of a resized or converted image |
contentLink(id, file?), contentLinks(links) |
a stored link to a node or one of its files, for HTML; what stored links point to |
const article = await store.get<IArticle>(id);
const [parent] = await store.getRelated(Article, id, 'Parent');
const url = await store.getUrl(id); // "/news/spring-opening"
const thumb = await store.fileUrl(id, 'Picture', { width: 320, height: 200, cropMode: 'Fill', requestedFormat: 'Webp' });An adjustment takes width, height, cropMode (Fill, Fit, Stretch or Auto),
requestedFormat (Jpeg, Png, Gif, Webp or Avif) and quality. The server makes the
variant the first time it is asked for. Unlike NodeStore.Get in C#, get applies read access.