The Telerik Platform product is retired.Learn more

Introduction to Data Relations

Introduction to Data Relations

Telerik Platform provides a document-based (NoSQL) database that is augmented with rudimentary relational features. When reading data from a content type, you have the option to add data from another content type to the request result.

You can also expand file metadata.

The content in this article is organized as follows:

What is a Relation

You have a relation between two content types when a field in one of them stores ID values from the other. For example:

Content Type A
    Id: "...",
    Relation_field: [

Content Type B
    Id: "type_b_Id1"
    Id: "type_b_Id2"

In this data structure content types A and B are related through content type A's Relation_field, which stores IDs from content type B.

Relation Expansion

Expanding a relation allows you to read data not only from the queried content type, but also from another related content type, all in a single request, and get the combined result in a single response. You can expand multiple relation fields in a content type as well as apply various options to filter, sort, and limit the expanded data.

You expand relations by defining an expand expression in your read request (in an X-Everlive-Expand HTTP header or a variable, depending on the SDK used).

Depending on which content type holds the relation, there are two relation expansion varieties:

  • Querying the content type that holds the relation
  • Querying the content type that does not hold the relation

Each of these has it's own expand definition syntax and limitations.

For expand expression syntax information, see Defining an Expand Expression. For limitations, see Limitations and Design Considerations.

Nested Expands

Expands can be nested to achieve more elaborate read requests. Nesting means expanding a relation found in the expanded data.

Nesting is subject to limitations. See Limitations and Design Considerations for details.

Applicable Operations

You can use expand expressions in read operations involving content types and metadata with some limitation. See Limitations and Design Considerations for details.

Cloud Code Events

The beforeRead and afterRead Cloud Code events are triggered for every request to a related content type.

Sample Data Model

The following data structure, derived from the Friends sample app, is used in most of the relation expand examples in this section. Refer to it to gain a better understanding of what each example tries to accomplish.

Activities Users Comments Roles
  • Id
  • Text
  • UserId
  • Likes
  • Id
  • DisplayName
  • Email
  • Picture
  • Id
  • Comment
  • UserId
  • ActivityId
  • Id
  • Name

See Also

Contact us: +1-888-365-2779
Copyright © 2016-2018, Progress Software Corporation and/or its subsidiaries or affiliates. All rights reserved.