File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -2416,14 +2416,20 @@ Query.prototype.merge = function(source) {
2416
2416
}
2417
2417
2418
2418
opts . omit = { } ;
2419
- if ( this . _conditions && Array . isArray ( source . $and ) ) {
2419
+ if ( Array . isArray ( source . $and ) ) {
2420
2420
opts . omit [ '$and' ] = true ;
2421
+ if ( ! this . _conditions ) {
2422
+ this . _conditions = { } ;
2423
+ }
2421
2424
this . _conditions . $and = ( this . _conditions . $and || [ ] ) . concat (
2422
2425
source . $and . map ( el => utils . isPOJO ( el ) ? utils . merge ( { } , el ) : el )
2423
2426
) ;
2424
2427
}
2425
- if ( this . _conditions && Array . isArray ( source . $or ) ) {
2428
+ if ( Array . isArray ( source . $or ) ) {
2426
2429
opts . omit [ '$or' ] = true ;
2430
+ if ( ! this . _conditions ) {
2431
+ this . _conditions = { } ;
2432
+ }
2427
2433
this . _conditions . $or = ( this . _conditions . $or || [ ] ) . concat (
2428
2434
source . $or . map ( el => utils . isPOJO ( el ) ? utils . merge ( { } , el ) : el )
2429
2435
) ;
You can’t perform that action at this time.
0 commit comments