Commit 913c2a39 authored by Jeremy Mikola's avatar Jeremy Mikola

Allow array/object for Collection::find() and findOne() $filter

parent c39542dd
...@@ -292,11 +292,11 @@ class Collection ...@@ -292,11 +292,11 @@ class Collection
* *
* @see Find::__construct() for supported options * @see Find::__construct() for supported options
* @see http://docs.mongodb.org/manual/core/read-operations-introduction/ * @see http://docs.mongodb.org/manual/core/read-operations-introduction/
* @param array $filter Query by which to filter documents * @param array|object $filter Query by which to filter documents
* @param array $options Additional options * @param array $options Additional options
* @return Cursor * @return Cursor
*/ */
public function find(array $filter = array(), array $options = array()) public function find($filter = array(), array $options = array())
{ {
$operation = new Find($this->dbname, $this->collname, $filter, $options); $operation = new Find($this->dbname, $this->collname, $filter, $options);
$server = $this->manager->selectServer(new ReadPreference(ReadPreference::RP_PRIMARY)); $server = $this->manager->selectServer(new ReadPreference(ReadPreference::RP_PRIMARY));
...@@ -309,11 +309,11 @@ class Collection ...@@ -309,11 +309,11 @@ class Collection
* *
* @see FindOne::__construct() for supported options * @see FindOne::__construct() for supported options
* @see http://docs.mongodb.org/manual/core/read-operations-introduction/ * @see http://docs.mongodb.org/manual/core/read-operations-introduction/
* @param array $filter The find query to execute * @param array|object $filter Query by which to filter documents
* @param array $options Additional options * @param array $options Additional options
* @return object|null * @return object|null
*/ */
public function findOne(array $filter = array(), array $options = array()) public function findOne($filter = array(), array $options = array())
{ {
$operation = new FindOne($this->dbname, $this->collname, $filter, $options); $operation = new FindOne($this->dbname, $this->collname, $filter, $options);
$server = $this->manager->selectServer(new ReadPreference(ReadPreference::RP_PRIMARY)); $server = $this->manager->selectServer(new ReadPreference(ReadPreference::RP_PRIMARY));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment