Skip to content

Commit

Permalink
fix(plugins): avoid converting array to object when tracking atomics …
Browse files Browse the repository at this point in the history
…within a transaction

Re: #14340
  • Loading branch information
vkarpov15 committed Feb 9, 2024
1 parent c9877b6 commit 4261e9f
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lib/plugins/trackTransaction.js
Expand Up @@ -85,7 +85,12 @@ function mergeAtomics(destination, source) {
destination.$addToSet = (destination.$addToSet || []).concat(source.$addToSet);
}
if (source.$set != null) {
destination.$set = Object.assign(destination.$set || {}, source.$set);
if (Array.isArray(destination.$set || []) && Array.isArray(source.$set || [])) {
destination.$set = (destination.$set || []).concat(source.$set);
} else {
destination.$set = Object.assign(destination.$set || {}, source.$set);
}

}

return destination;
Expand Down

0 comments on commit 4261e9f

Please sign in to comment.