public function getCollectionData($collection, $criteria = null)
    {
        if (is_null($this->dbPath)) {
            $this->prepareDatabaseEcosystem();
        }

        if (! is_dir($this->dbPath.'/'.$collection)) {
            mkdir($this->dbPath.'/'.$collection, 0755, true);
        }

        $rows = array();

        if ($handle = opendir($this->dbPath.'/'.$collection)) {
            while (false !== ($entry = readdir($handle))) {
                if (! in_array($entry, array('.', '..'))) {
                    if (is_readable($pathToFile = $this->dbPath.'/'.$collection.'/'.$entry)) {
                        $match   = true;
                        $raw     = file_get_contents($pathToFile);
                        $content = json_decode($raw, true);

                        if (! is_null($criteria) and ! empty($criteria)) {
                            if (isset($criteria['!or'])) {
                                $string = reset(array_values(reset($criteria['!or'])));

                                if (! preg_match('/'.$string.'/', strtolower($raw))) {
                                    $match = false;
                                }
                            } else {
                                $intersection = array_intersect_assoc($content, $criteria);

                                if (empty($intersection)) {
                                    $match = false;
                                }
                            }

                        }

                        if ($match) {
                            $rows[] = $content;
                        }
                    }
                }
            }

            closedir($handle);
        }

        return $rows;
    }