Skip to content

Commit b2f33fe

Browse files
committed
Merge pull request #700 from Dimasdanz/pecl-mongodb
Fix query select and query projection
2 parents 1826784 + e95ca8f commit b2f33fe

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/Jenssegers/Mongodb/Query/Builder.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -292,11 +292,12 @@ public function getFresh($columns = [])
292292
}
293293
$options = [];
294294

295-
// Apply order, offset, limit and hint
295+
// Apply order, offset, limit and projection
296296
if ($this->timeout) $options['maxTimeMS'] = $this->timeout;
297297
if ($this->orders) $options['sort'] = $this->orders;
298298
if ($this->offset) $options['skip'] = $this->offset;
299299
if ($this->limit) $options['limit'] = $this->limit;
300+
if ($columns) $options['projection'] = $columns;
300301
// if ($this->hint) $cursor->hint($this->hint);
301302

302303
// Fix for legacy support, converts the results to arrays instead of objects.
@@ -891,7 +892,7 @@ protected function compileWheres()
891892
// Convert DateTime values to UTCDateTime.
892893
if (isset($where['value']) and $where['value'] instanceof DateTime)
893894
{
894-
$where['value'] = new UTCDateTime($where['value']->getTimestamp());
895+
$where['value'] = new UTCDateTime($where['value']->getTimestamp() * 1000);
895896
}
896897

897898
// The next item in a "chain" of wheres devices the boolean of the

0 commit comments

Comments
 (0)