Webiny\Component\Mongo\Bridge\MongoInterface::findOne PHP Method

findOne() public method

Finds a single document matching the query.
See also: http://docs.mongodb.org/manual/core/read-operations-introduction/
public findOne ( string $collectionName, array | object $filter = [], array $options = [] ) : object | null
$collectionName string
$filter array | object Query by which to filter documents
$options array Additional options
return object | null
    public function findOne($collectionName, $filter = [], array $options = []);

Usage Example

Example #1
0
 public function findOne($collectionName, $filter = [], array $options = [])
 {
     return $this->bridge->findOne($this->cName($collectionName), $filter, $options);
 }