Exclude associations from autoFetch
See original GitHub issueautoFetch
is a really cool feature. But it can prove to be unpractical when returning far too much data, that is actually not needed.
Imagine having users and messages grouped into conversations with other participating users. Writing
user.getConversations({ autoFetch: true }, function (err, conversations) {
// conersation.participants
// conversation.messages
});
is really convenient, but it will return all messages for all conversations, even when they are not needed to display a overview of available conversations.
I would like to propose the following syntax:
user.getConversations({ autoFetch: [ 'participants' ] }, function (err, conversations) {
// conversation.participants
});
The autoFetch
will only include the associations given. If autoFetch
is set to true
, then just fetch all associations. If it is an array, only fetch the ones specified.
Issue Analytics
- State:
- Created 10 years ago
- Comments:5 (1 by maintainers)
Top Results From Across the Web
autofetch-2up.pdf - UT Computer Science
presents AUTOFETCH, a technique for automatically generating prefetch ... prefetch to ignore associations that are likely to be cached.
Read more >How to exclude association belongs-to-many from an instance ...
I'm trying to exclude a junction model from a query with the association of a model, this is how they are associated:
Read more >Can't exclude association's fields from select statement in ...
I have the following code (simplified): var group = sequelize.define("group", { id: {type: DataTypes.INTEGER, autoIncrement: false ...
Read more >User and Workspace Settings - Visual Studio Code
The first time you open a workspace that defines any of these settings, VS Code will warn you and then always ignore the...
Read more >User and Workspace Settings - vscode-docs
Search Configuration - file exclude filters; Git Configuration - disable Git integration, auto fetch behavior; Telemetry Configuration - disable telemetry ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
This is a great idea, will try to do it when I have some time.
+1