public function getFileIdForStream($stream)
    {
        $file = $this->getRawFileDocumentForStream($stream);

        /* Filter the raw document through the specified type map, but override
         * the root type so we can reliably access the ID.
         */
        $typeMap = ['root' => 'stdClass'] + $this->typeMap;
        $file = \MongoDB\apply_type_map_to_document($file, $typeMap);

        if ( ! isset($file->_id) && ! property_exists($file, '_id')) {
            throw new CorruptFileException('file._id does not exist');
        }

        return $file->_id;
    }
public function getFileIdForStream($stream)
    {
        $file = $this->getRawFileDocumentForStream($stream);

        /* Filter the raw document through the specified type map, but override
         * the root type so we can reliably access the ID.
         */
        $typeMap = ['root' => 'stdClass'] + $this->typeMap;
        $file = \MongoDB\apply_type_map_to_document($file, $typeMap);

        if ( ! isset($file->_id) && ! property_exists($file, '_id')) {
            throw new CorruptFileException('file._id does not exist');
        }

        return $file->_id;
    }
public function getFileIdForStream ( $ stream ) { $ file = $ this -> getRawFileDocumentForStream ( $ stream ) ; /* Filter the raw document through the specified type map, but override
         * the root type so we can reliably access the ID.
         */ $ typeMap = [ 'root' => 'stdClass' ] + $ this -> typeMap ; $ file = \ MongoDB \ apply_type_map_to_document ( $ file , $ typeMap ) ; if ( ! isset ( $ file -> _id ) && ! property_exists ( $ file , '_id' ) ) { throw new CorruptFileException ( 'file._id does not exist' ) ; } return $ file -> _id ; }
Gets the file document's ID of the GridFS file associated with a stream.

@param resource $stream GridFS stream
@return mixed
@throws CorruptFileException if the file "_id" field does not exist
@throws InvalidArgumentException if $stream is not a GridFS stream
@throws DriverRuntimeException for other driver errors (e.g. connection errors)
Gets the file document s ID of the GridFS file associated with a stream .