Answers for "loopback through include"

2

loopback relation include to json

Post.find({include: {owner: [{posts: 'images'} , 'orders']}}, function(err, posts) {
 posts.forEach(function(post) {
   // post.owner points to the relation method instead of the owner instance
   var p = post.toJSON();
   console.log(p.owner.posts, p.owner.orders);
 });
 //... 
});
Posted by: Guest on December-11-2020
6

loopback include relation

in url:
/customers?filter[include]=reviews

in code:
User.find({include: 'reviews'}, function() { /* ... */ });
Posted by: Guest on October-09-2020

Code answers related to "Javascript"

Browse Popular Code Answers by Language