References, also referred to as relations, are a powerful Field Type found within the Schema Builder that links different content models together.
An extension of our Reference Type Feature, One-Way References, like the name implies, can be used when the content model has only one relation or one direction that the information needs to be served from or connected to.
An example of One-Way Reference could include something like placing a legal footer at the bottom of particular content pieces. The information of the footer can be shared to that content piece, but the content it's attached to does not need to be shared with the footer model. In these cases, One-Way References can help reduce clutter within your Hygraph project and help improve performance.
Two-Way References creates relationships between content entries to share information. This type of Reference comes in four forms: one to one, one to many, many to one, and many to many. Essentially, both the referenced material and the referring material can be queried from either side.
To better explain it, we use the example of a blog piece and the author it's tied to. Think of a form of filtering or connecting, where we are trying to answer two questions: what blog posts has the author written, and sharing the author information within the blog post itself? By creating a Two-Way Reference in the Schema Builder, Content Creators can connect their blog post with their author profile to add their credentials easily within their blog post and connect all of their previous blogs to their profile.
Union Types, sometimes called Sortable Relations, are relations where developers are able to build a highly flexible basic model and content editors have the power to make changes to the presentation without changing the inherent structure. Teams can to change the order of specific relations of a content entry right from the UI enabling even more flexibility to how content will appear in its final form.
Specifically for Hygraph, Union Types allow for multiple models to be connected using a single relation. Teams can then choose which model to connect on a given content entry and in what order they would like the multiple models to be displayed.