-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
MONGOID-5391 - Add #pluck_each, extract out PluckEnumerator #5497
Open
johnnyshields
wants to merge
8
commits into
mongodb:master
Choose a base branch
from
johnnyshields:pluck-each-rebase
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@alexbevi @Neilshweky I really feel this PR should be merged. I find myself using it constantly in my app, it leads to a signficant Ruby performance gain. |
Hi @johnnyshields, this PR (and associated ticket) remains on our shortlist for continued discussion. I hope to have further information for you soon. |
johnnyshields
changed the title
MONGOID-5391 - Add #pluck_each, extract out PluckEnumerator
[READY FOR REVIEW] MONGOID-5391 - Add #pluck_each, extract out PluckEnumerator
Feb 10, 2023
50 tasks
johnnyshields
changed the title
[READY FOR REVIEW] MONGOID-5391 - Add #pluck_each, extract out PluckEnumerator
🚀 [READY FOR REVIEW] MONGOID-5391 - Add #pluck_each, extract out PluckEnumerator
Apr 11, 2023
Merged into Mongoid Ultra 🌈 |
1 task
jamis
changed the title
🚀 [READY FOR REVIEW] MONGOID-5391 - Add #pluck_each, extract out PluckEnumerator
MONGOID-5391 - Add #pluck_each, extract out PluckEnumerator
Apr 15, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes MONGOID-5391
I'd like to humbly request this feature for reconsideration to be merged. A certain Mongoid maintainer of xmas past rejected this on the grounds that there are plans in MONGOID-5411 to make a feature which returns query raw results as a demongoized, field-name-aliased Hash. I fully support doing MONGOID-5411, however its timeline is unspecified (still in "Needs Triage" state), whereas this feature (
#pluck_each
) is ready to be used today. It yields a tremendous performance gain 🚀 and I've gotten a ton of mileage out of it in my app.I also feel that this feature is not mutually exclusive functionality-wise with MONGOID-5411. Although the API syntax of MONGOID-5411 is not yet defined, if you just want to pluck a single value, it will look something like
.only(:my_field).query_as_hash.each {|result| result[:my_field] }
whereas the same in this code can be done here far more tersely as.pluck_each(:my_field) {|value| ... }
Lastly, I think the extraction of PluckEnumerator in this PR is probably a stepping stone toward implementing MONGOID-5411. I'd be happy to add looking at MONGOID-5411 to my queue.
For reference, the previously closed PR including discussion is here: #5332