File tree Expand file tree Collapse file tree 1 file changed +6
-1
lines changed
src/Jenssegers/Mongodb/Query Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -285,14 +285,19 @@ public function getFresh($columns = [])
285
285
$ columns [$ column ] = true ;
286
286
}
287
287
288
+ // Add custom projections.
289
+ if ($ this ->projections )
290
+ {
291
+ $ columns = array_merge ($ columns , $ this ->projections );
292
+ }
288
293
$ options = [];
289
294
290
295
// Apply order, offset, limit and projection
291
296
if ($ this ->timeout ) $ options ['maxTimeMS ' ] = $ this ->timeout ;
292
297
if ($ this ->orders ) $ options ['sort ' ] = $ this ->orders ;
293
298
if ($ this ->offset ) $ options ['skip ' ] = $ this ->offset ;
294
299
if ($ this ->limit ) $ options ['limit ' ] = $ this ->limit ;
295
- if ($ this -> projections ) $ options ['projection ' ] = $ this -> projections ;
300
+ if ($ columns ) $ options ['projection ' ] = $ columns ;
296
301
// if ($this->hint) $cursor->hint($this->hint);
297
302
298
303
// Fix for legacy support, converts the results to arrays instead of objects.
You can’t perform that action at this time.
0 commit comments