public function map($handler)
    {
        $result = array();

        foreach ($this as $id => $document) {
            $result[$id] = $handler($document);
        }

        return $result;
    }
public function map($handler)
    {
        $result = array();

        foreach ($this as $id => $document) {
            $result[$id] = $handler($document);
        }

        return $result;
    }
public function map ( $ handler ) { $ result = array ( ) ; foreach ( $ this as $ id => $ document ) { $ result [ $ id ] = $ handler ( $ document ) ; } return $ result ; }
Apply callable to all documents in cursor

@param callable $handler
@return array
Apply callable to all documents in cursor