Members
(static) normalizeInclude
Normalize includes - used in DataAccessObject
- Source:
Methods
(static) include(objects, include, optionsopt, cb)
Enables you to load relations of several objects and optimize numbers of requests.
Examples:
Load all users' posts with only one additional request:
`User.include(users, 'posts', function() {});`
Or
`User.include(users, ['posts'], function() {});`
Load all users posts and passports with two additional requests:
`User.include(users, ['posts', 'passports'], function() {});`
Load all passports owner (users), and all posts of each owner loaded:
```Passport.include(passports, {owner: 'posts'}, function() {});
``` Passport.include(passports, {owner: ['posts', 'passports']});
``` Passport.include(passports, {owner: [{posts: 'images'}, 'passports']});
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
objects |
Array | Array of instances | |
include |
String | Object | Array | Which relations to load. | |
options |
Object |
<optional> |
Options for CRUD |
cb |
function | Callback called when relations are loaded |
- Source: