Skip to content

Commit

Permalink
address code review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
vkarpov15 committed May 9, 2024
1 parent 0df5b30 commit 3187842
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions lib/query.js
Original file line number Diff line number Diff line change
Expand Up @@ -2382,18 +2382,17 @@ Query.prototype.merge = function(source) {
opts.omit = {};
if (source.$and) {
opts.omit['$and'] = true;
if (!this._conditions) { // maybe unnecessary?
if (!this._conditions) {
this._conditions = {};
}
this._conditions.$and = (this._conditions.$and || []).concat(source.$and);
}
if (source.$or) {
opts.omit['$or'] = true;
if (this._conditions && this._conditions.$or) {
this._conditions.$or = this._conditions.$or.concat(source.$or);
} else {
this._conditions.$or = [...source.$or];
if (!this._conditions) {
this._conditions = {};
}
this._conditions.$or = (this._conditions.$or || []).concat(source.$or);
}

// plain object
Expand Down

0 comments on commit 3187842

Please sign in to comment.