# File lib/rufus/cloche.rb, line 174
    def get_many(type, regex=nil, opts={})

      opts = opts.inject({}) { |h, (k, v)| h[k.to_s] = v; h }

      d = dir_for(type)

      return (opts['count'] ? 0 : []) unless File.exist?(d)

      regexes = regex ? Array(regex) : nil

      docs = []
      skipped = 0

      limit = opts['limit']
      skip = opts['skip']
      count = opts['count'] ? 0 : nil

      files = Dir[File.join(d, '**', '*.json')].sort_by { |f| File.basename(f) }
      files = files.reverse if opts['descending']

      files.each do |fn|

        key = File.basename(fn, '.json')

        if regexes.nil? or match?(key, regexes)

          skipped = skipped + 1
          next if skip and skipped <= skip

          doc = get(type, key)
          next unless doc

          if count
            count = count + 1
          else
            docs << doc
          end

          break if limit and docs.size >= limit
        end
      end

      # WARNING : there is a twist here, the filenames may have a different
      #           sort order from actual _ids...

      #docs.sort { |doc0, doc1| doc0['_id'] <=> doc1['_id'] }
        # let's trust filename order

      count ? count : docs
    end