Phactory\Mongo\Phactory::get PHP Method

get() public method

* Get a document from the database as an array.
public get ( $collection_name, $query )
$collection_name name of the collection
$query a MongoDB query
    public function get($collection_name, $query)
    {
        if (!is_array($query)) {
            throw new \Exception("\$query must be an associative array of 'field => value' pairs");
        }
        $collection = new Collection($collection_name, true, $this);
        return $collection->findOne($query);
    }