-
Notifications
You must be signed in to change notification settings - Fork 376
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fetch associations for an array of models when autoFetch
is off (similar to Mongoose's populate
) ?
#120
Comments
I'm sorry for not replying earlier but I'm a little short in time. I have to take some time to test more properly before answering you. |
It seems there is some trouble with passing |
This fix doesn't magically solve your problem. I would advise you to do this way:
|
Yup, that works great, thanks! |
Yeah, that might open the can, I have to think a bit more about the cache keys. |
I have two models with a many to many relationship, routes and stops (for buses)
given an api like below:
I don't want
/routes
nor/stops
to autoload, there's too much data, but I do want/routes/:ids/stops
to autoload, and same for/stops/:ids/routes
.Is this possible?
Also, what's a way to do it without using autoload?
I've gotten this far:
but I'm currently stuck trying to figure out how to make sure all the
route.getStops
have returned before sending the response.Would I need a promise library to deal with this?
edit: dug around the source, found this but I don't seem to be using it correctly
setting this doesn't seem to affect anything
edit: setting it as an option passed to find doesn't seem to work either
edit: ~~~possibly solved?~~~ (nvm, apparently this messes up caching)
changed line 245 of Model.js from
to
to allow specifying
autoFetch
as an option when callingfind
.was this a typo or was the
autoFetch
not intended to be override-able?edit: apparently changing that messes up caching.
or
whichever one gets called first ends up determining autoFetch forever.
setting instance settings via request.models.model.settings.set didn't work either
The setting does change but it doesn't seem to affect the output
The text was updated successfully, but these errors were encountered: