@@ -214,7 +214,11 @@ RestQuery.prototype.replaceInQuery = function() {
214
214
} ) ;
215
215
}
216
216
delete inQueryObject [ '$inQuery' ] ;
217
- inQueryObject [ '$in' ] = values ;
217
+ if ( Array . isArray ( inQueryObject [ '$in' ] ) ) {
218
+ inQueryObject [ '$in' ] = inQueryObject [ '$in' ] . concat ( values ) ;
219
+ } else {
220
+ inQueryObject [ '$in' ] = values ;
221
+ }
218
222
219
223
// Recurse to repeat
220
224
return this . replaceInQuery ( ) ;
@@ -251,7 +255,11 @@ RestQuery.prototype.replaceNotInQuery = function() {
251
255
} ) ;
252
256
}
253
257
delete notInQueryObject [ '$notInQuery' ] ;
254
- notInQueryObject [ '$nin' ] = values ;
258
+ if ( Array . isArray ( notInQueryObject [ '$nin' ] ) ) {
259
+ notInQueryObject [ '$nin' ] = notInQueryObject [ '$nin' ] . concat ( values ) ;
260
+ } else {
261
+ notInQueryObject [ '$nin' ] = values ;
262
+ }
255
263
256
264
// Recurse to repeat
257
265
return this . replaceNotInQuery ( ) ;
@@ -290,7 +298,11 @@ RestQuery.prototype.replaceSelect = function() {
290
298
values . push ( result [ selectValue . key ] ) ;
291
299
}
292
300
delete selectObject [ '$select' ] ;
293
- selectObject [ '$in' ] = values ;
301
+ if ( Array . isArray ( selectObject [ '$in' ] ) ) {
302
+ selectObject [ '$in' ] = selectObject [ '$in' ] . concat ( values ) ;
303
+ } else {
304
+ selectObject [ '$in' ] = values ;
305
+ }
294
306
295
307
// Keep replacing $select clauses
296
308
return this . replaceSelect ( ) ;
@@ -329,7 +341,11 @@ RestQuery.prototype.replaceDontSelect = function() {
329
341
values . push ( result [ dontSelectValue . key ] ) ;
330
342
}
331
343
delete dontSelectObject [ '$dontSelect' ] ;
332
- dontSelectObject [ '$nin' ] = values ;
344
+ if ( Array . isArray ( dontSelectObject [ '$nin' ] ) ) {
345
+ dontSelectObject [ '$nin' ] = dontSelectObject [ '$nin' ] . concat ( values ) ;
346
+ } else {
347
+ dontSelectObject [ '$nin' ] = values ;
348
+ }
333
349
334
350
// Keep replacing $dontSelect clauses
335
351
return this . replaceDontSelect ( ) ;
0 commit comments