-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Add support for .populate({ select: [] }) #5549
Comments
I did not know you could select only certain attributes. Can you point to the docs on this? |
Possibly related to #509, which will be a part of 0.11. |
I have been reading the code which seems to be written as if this is the behaviour... populate.js and deferred.js The only documentation I found is here Maybe it's still work in progress? |
Do you guys know when that |
I know waterline supports "populate where": |
If someone thinks this isn't full answered, feel free to reopen. But as of now, there's no |
shoud be a feature request |
subscribers: sorry for the buzz :P nothing interesting to read. |
Thanks @anasyb, that's valuable information. Some of it is actually in the docs (https://github.com/balderdashy/waterline-docs/blob/master/query.md#populate) but Meanwhile at @atiertant's request I've changed this issue into a feature request and reopened it. |
I have created a simple project to test the issue and it seems that waterline with the disk adapter (the default one) does work great with populate's selects. |
@nonpc, can you submit a patch to waterline-adapter-tests? There is already a find.populate.where.js suite of tests, so perhaps add a find.populate.select.js in https://github.com/balderdashy/waterline-adapter-tests/tree/master/interfaces/associations/manyToMany |
I have actually mostly fixed the issue but I don't feel good enough to do a pull request. Changing the beginning of the query to: Most of the logic resides here, a lot of copy-pasteing done from the select.js file: Mind you, I've only tested it on MySQL. I am actually not a fan of doing these seperate queries on simple joins so I myself am going to change all of the populate() to .query() and do all the joins myself until (if ever) all this gets fully solved. |
I see, if you do find a fix you're comfortable with please let us know, thanks. |
👍 this would be a good feature |
@nonpc the problem is you will need to correct it in 3 times :
@dmarcelino would you be ok with this ? do you think it's a feature or a bug ? |
The first 2 are definitely right. I'm not sure about "PR waterline-sequel to correct the hardcoded * ." as I'm not aware of such hardcode. I'll trust your judgement there. Feature or bug... definitions are not always easy... :) Given that only recently |
Just to let you guys know: this feature will come in handy ! |
Can't we use the methods like :toJSON or other custom methods on models to override the returning result ? And will this work on an array of result ? |
This would significantly improve performance for deletions of highly nested populations. |
I've even tried modifying Is select on joins supported at all? |
@shamasis i think modifying
|
@atiertant I've already implemented the correct join selects on a fork of waterline we maintain. Almost all adapters we tested does not respect the select criteria in joins. That's what I am working next. Will post updates and send PR when I can get around to it. |
That would be great. If there is a common pattern to convert the adapters, do share! |
Thanks for posting, @anasyb. I'm a repo bot-- nice to meet you! It has been 30 days since there have been any updates or new comments on this page. If this issue has been resolved, feel free to disregard the rest of this message. On the other hand, if you are still waiting on a patch, please:
Thanks so much for your help! |
+1 |
1 similar comment
👍 |
This has been merged along with official support for |
👍 |
Excellent I'll love it. |
I think there is another bug for this select. I have a query need to populate two objects like
Here is the response: The user object isn't populate. But when I remove the select from populating user, it will return the full user object. Can someone take a look? I am install sails.js and waterline both. "sails": "~0.12.3", |
@xueenda if you want some help, you should post your models definitions and some sample to reproduce bug... which adapter do you use? did you tryed with an other one? |
@particlebanana Any news about supporting .select() with a new version of Sails? |
@billyshena i just tried with populate and it is working like a charm v 0.12.3 populate('relation', { select: ['wantedFields', ...] }); |
+1 |
@particlebanana Pls, Any news about supporting .populate({ select: [] }) with Sails v0.12 (sails-hook-orm) ? |
Still no support for this ? |
As @driftman pointed out, it works perfectly. |
@mortea15 I am using Sails v0.12.13 with the following code |
@rstrange1992 as far as I can tell, it doesn't work with MySQL, and perhaps other DBs. I switched to MongoDB, which works fine. |
@mortea15 It doesn't seem to be working with Postgresql either, just so that other people know. |
it should work with MYSQL, Postgresql and others with the adapter offshore-sql |
This still does not work for mysql on sails 0.12.14 |
same as @anshumanr |
Same for for mysql on sails 0.12.14 |
Hello guys, any news on this issue ? |
is this supported? |
What happened to this feature? Is it supported? It doesn't work on Sails 1.2.3. |
I made some tests. It works currently only with a population of one-to-many relationship. I made a pull request to solve the one-to-one relationship issue: |
Any news about it? |
I'm still waiting for someone from the sails team to review the pull request. If you really need to solve the issue immediately just update I did it in most of my projects and until now I didn't face any problems with the fix. But as the pull request has not yet been accepted, please make sure to have a backup. |
Do the limitations in Waterline currently stand at:
|
The
select
is being ignored.. getting back the full records instead of just the titles.Not sure if its only on mongo?
UPDATE @dmarcelino: changed this issue into a feature request.
The text was updated successfully, but these errors were encountered: