model.bulkCreate modifies the "options" by assigning "model" as an attribute to the object #12406
Open
2 tasks done
Labels
Comments
|
Hey!, It's my first time contributing . I would like to take a stab at this issue. Please correct me if i'm wrong here , in this issue all we need to do is create a copy of Model's object and assign it to |
|
Nope, I think you need to clone options (just like other implementations in the same file) using Object.assign, This will make sure the passed in object reference is not polluted |
|
oh yeah, thanks. On it |
|
Hello, @walkerps are still working on this? |
6 tasks
|
@JuarezLustosa I went ahead and raised a fix. Do review it |
6 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Issue Description
While using model.bulkCreate, as we pass the options, an object which contains transaction, it comes modified after the execution
What are you doing?
We have called bulkCreate on a model object. The options object which is prepared as an argument to the function, if we check it after execution, it contains the reference to the model object.
Here is the link to the SSCCE for this issue: LINK-HERE
What do you expect to happen?
The options object should not have been modified.
What is actually happening?
The options object now have a reference to "model" object.
Additional context
When we checked the code in sequelize -> model.js, it reflected the assignment on the passed in argument, instead of using the cloned copy of "options"
Environment
Issue Template Checklist
How does this problem relate to dialects?
Would you be willing to resolve this issue by submitting a Pull Request?
The text was updated successfully, but these errors were encountered: