1Post.find({include: {owner: [{posts: 'images'} , 'orders']}}, function(err, posts) {
2 posts.forEach(function(post) {
3 // post.owner points to the relation method instead of the owner instance
4 var p = post.toJSON();
5 console.log(p.owner.posts, p.owner.orders);
6 });
7 //...
8});
1Post.find({
2 include: {
3 relation: 'owner', // include the owner object
4 scope: { // further filter the owner object
5 fields: ['username', 'email'], // only show two fields
6 include: { // include orders for the owner
7 relation: 'orders',
8 scope: {
9 where: {orderId: 5} // only select order with id 5
10 }
11 }
12 }
13 }
14}, function() { /* ... */ });
15
1// Return all post owners (users), and all posts and orders of
2// each owner. The posts also include images.
3Post.find({include: {owner: [{posts: 'images'} , 'orders']}},
4 function() { /* ... */ });
1<ion-datetime displayFormat="HH:mm" [(ngModel)]="myDate" minuteValues="0,30">
2
1in url:
2/customers?filter[include]=reviews
3
4in code:
5User.find({include: 'reviews'}, function() { /* ... */ });