Reputation: 319
I have the next two models:
module.exports = {
identity: 'WebsiteWidget',
attributes: {
name: 'string',
type: {
type: 'string',
enum: ['fullPage', 'container', 'base']
},
container: {
model: 'container'
},
widget: {
model: 'widget'
},
page: {
model: 'page'
},
data: {
type: 'json'
},
output: {
type: 'text'
},
widgetHtml: {
model: 'widgethtml'
},
sort: 'integer'
}
}
module.exports = {
attributes: {
widget: 'string',
templateName: 'string',
source: 'text',
settings: 'json'
}
};
The thing is that WebsiteWidget
holds an id
of WidgetHtml
, when i execute a find query, the websiteHtml
property returns just the id
instead of the whole WidgetHtml
model.
What is the problem?
Upvotes: 3
Views: 638
Reputation: 8292
You need to explicitly tell waterline to retrieve your WidgetHtml like :
WebsiteWidget.find(....).populate("widgetHtml").exec(function(err, website))
{
//Do what you want
});
Upvotes: 2