Skip to content
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

continuation of deep populate #24

Open
atiertant opened this issue Apr 4, 2016 · 2 comments
Open

continuation of deep populate #24

atiertant opened this issue Apr 4, 2016 · 2 comments

Comments

@atiertant
Copy link
Author

@mikermcneil

The issue with this approach is specifically when dealing with bidirectional "hasMany" associations that stretch across different databases, and combining that behavior with sort. In order to do that, you have to fetch all records in the junction table/collection -- the in-between model storing the records associating both sides of the bidirectional collection ("hasMany") association. It's a perfectly fine solution unless your database(s) are large. But for certain production use cases (i.e. where you have millions of records), this is not okay; it can overflow RAM and kills your Node process.

where have you seen this deep code ? has i explained you:

this code will
1 - compagyn.find(id).populate('driver')
2 - the deepCursor will collect all drivers pk and index reference to driver objects.
3 - driver.find([cursor previously collected drivers pk]).populate('taxi')
4 - cursor link results in compagny.driver previously indexed
which database doesn't suport this ?

this code will never fetch all records in the junction table/collection and crash node process...
if it does, this is the original waterline populate who do this...

sorry if you can't lock this conversation but be sure i'll don't !

@emahuni
Copy link

emahuni commented Jul 27, 2018

i have some implementation, but i saw this in the issues of waterline: go thru it in waterline.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants