lib/couch.rb
# Returns an array of all ids in the database
Returns an array of all ids in the database
Returns an array of all ids in the database
def all_ids(db, limit=500, opts={}, &block)
        all_docs = []
        start_key = nil
        loop do
          opts = opts.merge({limit: limit})
          if start_key
            opts[:startkey]=start_key
          end
          docs = (lambda { |options| get_all_ids(db, options) }).call(opts)
          if docs.length <= 0
            break
          else
            if block
              block.call(docs)
            else
              all_docs < docs
            end
            start_key ="\"#{docs.last}\\ufff0\""
          end
        end
        all_docs.flatten
      end
def all_ids ( db , limit = 500 , opts = { } , & block ) all_docs = [ ] start_key = nil loop do opts = opts . merge ( { limit : limit } ) if start_key opts [ :startkey ] = start_key end docs = ( lambda { | options | get_all_ids ( db , options ) } ) . call ( opts ) if docs . length <= 0 break else if block block . call ( docs ) else all_docs < docs end start_key = "\"#{docs.last}\\ufff0\"" end end all_docs . flatten end
Returns an array of all ids in the database
Returns an array of all ids in the database
db
<not_specific>
limit
<not_specific>
opts
<not_specific>
block
<not_specific>