Skip to main content
Version: v4.5

Relationships

In the Item Service, you can create parent-child relationships between RelatedItems in the same collection or in different collections of the same type.

In a relationship, there is one parent item and one or more child items. A RelatedItem can be a child in one relationship and a parent in another.

To create a Relationship, see Creating relationships.

Real-world relationship example#

Querying relationships#

You can query relationships in a parent-child direction or in an inverse child-parent direction.

For more information on querying RelatedItems by relationship, see Related queries.

Parent-child query#

In the following example, you can query a TelemetryItems collection for a specific sensor and return its related readings:

Child-parent query#

To query a Relationship in a child-parent direction, you can use the optional _isInverse: true flag.

The following example show that you can query a telemetry readings collection for a specific condition and return the related sensor of readings that match the condition:

Schema#

For more information on the Relationship type and its properties, refer to the For more information on this schema, see the Relationship schema.