Document.prototype.populate >= 1.1.0

Purpose

Add associated data to this record

Syntax

Document#populate ( Stringalias );

Parameters

alias
The alias of the association to populate

Return values

Examples

Add comments to a blog post

Say you have a Blog model that hasMany Comments, you could get those comments like this:

// Get the Blog model instance
let blog_model = Model.get('Blog');

// Get a blog post
let blog_post = await blog_model.find('first');

// Now add the comments
await blog_post.populate('Comments');