Fields and projections
Last updated
Last updated
This is the official documentation of the @forestadmin/agent
Node.js agent.
Field identifiers simply are strings that identify a column in the context of a collection.
Letβs consider the following database structure; collections, fields and relationships:
In this context, youβll find below some examples that show valid and invalid field calls:
Collection | Field | Valid? |
---|
Projections are mainly used to fetch partial records and automatically fetch linked records.
Projections simply are an array of fields.
Books | "title" | π’ Yes |
Books | "myAuthor:firstname" | π’ Yes |
Books | "myReviews:content" | β No, only relationships which yield one record can be traversed |
Reviews | "content" | π’ Yes |
Reviews | "myBook:title" | β No, reverse relationships are not automatically defined |