Skip to content

Commit

Permalink
uprava funkce find mongodb adapteru (#U015629)
Browse files Browse the repository at this point in the history
  • Loading branch information
ViPErCZ committed May 22, 2019
1 parent 3b281b1 commit dd03d6f
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/Adapter/Mongodb.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,11 +97,17 @@ public function drop($collection)
return $this->db->{$collection}->drop();
}

/**
* @param string $collection
* @param array $query
* @param array $fields
* @return array
*/
public function find($collection, $query = [], $fields = [])
{
$this->connect();
$cursor = $this->db->{$collection}->find($query, $fields)->toArray();
return isset($cursor[0]) ? $cursor[0] : new \ArrayObject();

return $this->db->{$collection}->find($query, $fields)->toArray();
}

public function findOne($collection, $query = [], $fields = [])
Expand Down

0 comments on commit dd03d6f

Please sign in to comment.