@@ -325,26 +325,29 @@ RestQuery.prototype.replaceDontSelect = function() {
325
325
// Returns a promise for whether it was successful.
326
326
// Populates this.response with an object that only has 'results'.
327
327
RestQuery . prototype . runFind = function ( ) {
328
- if ( this . findOptions . limit !== 0 ) {
329
- return this . config . database . find (
330
- this . className , this . restWhere , this . findOptions ) . then ( ( results ) => {
331
- if ( this . className === '_User' ) {
332
- for ( var result of results ) {
333
- delete result . password ;
334
- }
328
+ if ( this . findOptions . limit === 0 ) {
329
+ this . response = { results : [ ] } ;
330
+ return Promise . resolve ( ) ;
331
+ }
332
+ return this . config . database . find (
333
+ this . className , this . restWhere , this . findOptions ) . then ( ( results ) => {
334
+ if ( this . className === '_User' ) {
335
+ for ( var result of results ) {
336
+ delete result . password ;
335
337
}
338
+ }
336
339
337
- this . config . filesController . expandFilesInObject ( this . config , results ) ;
340
+ this . config . filesController . expandFilesInObject ( this . config , results ) ;
338
341
339
- if ( this . keys ) {
340
- var keySet = this . keys ;
341
- results = results . map ( ( object ) => {
342
- var newObject = { } ;
343
- for ( var key in object ) {
344
- if ( keySet . has ( key ) ) {
345
- newObject [ key ] = object [ key ] ;
346
- }
342
+ if ( this . keys ) {
343
+ var keySet = this . keys ;
344
+ results = results . map ( ( object ) => {
345
+ var newObject = { } ;
346
+ for ( var key in object ) {
347
+ if ( keySet . has ( key ) ) {
348
+ newObject [ key ] = object [ key ] ;
347
349
}
350
+ }
348
351
return newObject ;
349
352
} ) ;
350
353
}
@@ -354,12 +357,8 @@ RestQuery.prototype.runFind = function() {
354
357
r . className = this . redirectClassName ;
355
358
}
356
359
}
357
- this . response = { results : results } ;
358
- } ) ;
359
- } else {
360
- this . response = { results : [ ] } ;
361
- return Promise . resolve ( ) ;
362
- }
360
+ this . response = { results : results } ;
361
+ } ) ;
363
362
} ;
364
363
365
364
// Returns a promise for whether it was successful.
0 commit comments