Open
Description
Steps to reproduce
Query data by including hasmany relation..
// Exemple
result = await this.authorRepository.findOne({ where: { id : '<authorId>'}, include:['books'] })
Current Behavior
in the result, you will notice that books is undefined for authors who dont have any books.
[
{
id : 'xxxx',
name : 'abc',
# books is undefined
},
{
id : 'xxxx',
name : 'abc',
books : [
{
id : 'xxxxx',
title : 'zzzzz'
}
]
}
]
Expected Behavior
Books should return empty array for authors who don't have books. it was like that in loopback 3.
[
{
id : 'xxxx',
name : 'abc',
books : [] #should be like that
},
{
id : 'xxxx',
name : 'abc',
books : [
{
id : 'xxxxx',
title : 'zzzzz'
}
]
}
]
Link to reproduction sandbox
Additional information
Related Issues
See Reporting Issues for more tips on writing good issues