Skip to content

Commit

Permalink
Merge pull request #191 from feathersjs/populate-b
Browse files Browse the repository at this point in the history
Fixed populate issue with recursive include
  • Loading branch information
eddyystop authored May 20, 2017
2 parents e0d34e0 + 2c2b5a3 commit c8a95dd
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/services/populate.js
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ function populateAddChild (options, hook, parentItem, childSchema, depth) {
result = result[0];
}

return childSchema.include
return (childSchema.include && result)
? populateItemArray(options, hook, result, childSchema.include, depth) : result;
})
.then(items => ({ nameAs, items }));
Expand Down
10 changes: 9 additions & 1 deletion test/helpers/get-init-db.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,15 @@ module.exports = function (name) {
author: '167asdf3689348sdad7312131s',
readers: ['as61389dadhga62343hads6712', '167asdf3689348sdad7312131s'],
createdAt: 1480793101559
}
},
'4': {
id: 4,
title: 'Post 4',
content: 'Lorem ipsum dolor sit amet 5',
author: '167asdf3689348sdad7312131s',
readers: [],
createdAt: 1480793101559
}
};

const recommendation = {
Expand Down

0 comments on commit c8a95dd

Please sign in to comment.