/** * Querys this collection, returning a single element * @link http://www.php.net/manual/en/mongocollection.findone.php * @param array $query The fields for which to search. * @param array $fields Fields of the results to return. * @return array|null */ public function findOne(array $query = array(), array $fields = array()) { $document = $this->collection->findOne(TypeConverter::convertLegacyArrayToObject($query), ['projection' => $fields]); if ($document !== null) { $document = TypeConverter::convertObjectToLegacyArray($document); } return $document; }
/** * Returns the current element * @link http://www.php.net/manual/en/mongocursor.current.php * @return array */ public function current() { $document = $this->ensureIterator()->current(); if ($document !== null) { $document = TypeConverter::convertObjectToLegacyArray($document); } return $document; }