Method: Arango::Collection#documents

Defined in:
lib/Collection.rb

#documents(type: "document") ⇒ Object

“path”, “id”, “key”



251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
# File 'lib/Collection.rb', line 251

def documents(type: "document") # "path", "id", "key"

  @returnDocument = false
  if type == "document"
    @returnDocument = true
    type = "key"
  end
  satisfy_category?(type, ["path", "id", "key", "document"])
  body = { "type": type, "collection": @name }
  result = @database.request("PUT", "_api/simple/all-keys", body: body)
  @hasMoreSimple = result[:hasMore]
  @idSimple = result[:id]
  return result if return_directly?(result)
  return result[:result] unless @returnDocument
  if @returnDocument
    result[:result].map{|key| Arango::Document.new(name: key, collection: self)}
  end
end