Skip to end of metadata
Go to start of metadata

An include filter enables you to include results from related models in a query, for example models that have belongsTo or hasMany relations, to optimize the number of requests.  See Creating model relations for more information.

The value of the include filter can be a string, an array, or an object.


You can use an include filter with find(), findOne() and findById().


You can also use stringified JSON format in a REST query.

Node API


Methods of models in the AngularJS client have a different signature than those of the Node API. For more information, see AngularJS SDK API.

{include: 'relatedModel'}
{include: ['relatedModel1', 'relatedModel2', ...]}
{include: {relatedModel1: [{relatedModel2: ‘propertyName’} , ‘relatedModel’]}}

  • relatedModel, relatedModel1, and relatedModel2 are the names (pluralized) of related models.
  • propertyName is the name of a property in the related model.


Include relations without filtering:

Return all post owners (users), and all orders of each owner:

Return all post owners (users), and all friends and orders of each owner:

Return all post owners (users), and all posts and orders of each owner. The posts also include images.

  • No labels