Answers for "loopback filter fields in relation"

1

loopback include multiple relations

Post.find({
  include: {
    relation: 'owner', // include the owner object
    scope: { // further filter the owner object
      fields: ['username', 'email'], // only show two fields
      include: { // include orders for the owner
        relation: 'orders', 
        scope: {
          where: {orderId: 5} // only select order with id 5
        }
      }
    }
  }
}, function() { /* ... */ });
Posted by: Guest on December-24-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