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

        foreach ($this as $id => $document) {
            if (!$handler($document)) {
                continue;
            }

            $result[$id] = $document;
        }

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

        foreach ($this as $id => $document) {
            if (!$handler($document)) {
                continue;
            }

            $result[$id] = $document;
        }

        return $result;
    }
public function filter ( $ handler ) { $ result = array ( ) ; foreach ( $ this as $ id => $ document ) { if ( ! $ handler ( $ document ) ) { continue ; } $ result [ $ id ] = $ document ; } return $ result ; }
Filter documents in cursor by condition in callable

@param callable $handler
@return array
Filter documents in cursor by condition in callable