-
Notifications
You must be signed in to change notification settings - Fork 804
[MODEL] Support :scope, :query and :preprocess importing options for Mongoid #786
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
Conversation
022a071
to
8f81fc5
Compare
@Seitk , this sounds right! Since we're planning some re-focus to the libraries soon, I'd rather not merge it now, in a couple of weeks we should have more capacity to give your PR and other PRs more attention... |
@@ -64,9 +64,16 @@ module Importing | |||
# | |||
def __find_in_batches(options={}, &block) | |||
options[:batch_size] ||= 1_000 | |||
query = options.delete(:query) | |||
named_scope = options.delete(:scope) | |||
preprocess = options.delete(:preprocess) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you mind if we just set the :query
, :scope
and :preprocess
options instead of deleting them from the options
hash? I'd rather not mutate the options
that the user passes to the #import
method. Thanks!
Hi @Seitk I added a comment, let me know what you think so we can get this merged. |
013669b
to
c09746d
Compare
@estolfo updated, should i change base on this PR or open a new one lol? |
@Seitk Sure you can update this PR, thanks! |
4018be8
to
656ca2c
Compare
@estolfo The default scope is supported by default with the "all" criteria, added integration test for mongoid with default scope anyway |
btw I am using "5.x" for a production service, i will create another PR for "6.x" separately |
@Seitk Thanks for the reminder about the default_scope via |
The elasticsearch model readme said It's possible to import only records from scope or query and preprocess batch data but it's not implemented