ArangoDB#

AQL Examples#

Query all documents from a collection:#

FOR doc IN collection
  RETURN doc

Filter documents from a collection:#

FOR doc IN collection
  FILTER doc.name == "Philip"
  RETURN doc

Filter documents without surname attribute name from a collection:#

FOR doc IN collection
  FILTER HAS(doc, "surname")
  RETURN doc

Query at most 10 documents from a collection:#

FOR doc IN collection
  LIMIT 10
  RETURN doc

Filter and count documents from a collection:#

FOR doc IN collection
  FILTER doc.name == "Philip"
  COLLECT WITH COUNT INTO length
  RETURN length

Group and Count#

FOR doc IN collection
  COLLECT attribute = doc.attribute WITH COUNT INTO count
  RETURN {
    "attribute" : attribute,
    "count" : count
  }

Delete Attribute#

FOR doc IN collection
  UPDATE doc WITH { not_needed: null } IN collection
  OPTIONS { keepNull: false }