AQL 如何 return 整个文档而不是文档的单个项目

AQL how to return entire document instead of single item of document

下面是 AQL 查询。

for doc in `managed-function`
  collect mkey = doc.mkey
  return mkey

以上查询 returns 唯一唯一的 mkey 列表。 我想要返回整个文档,我该如何实现?

您需要在 COLLECT 操作中添加一个 INTO 子句,例如:

for doc in `managed-function`
  collect mkey = doc.mkey into docs = doc
  return {mkey, docs}

https://www.arangodb.com/docs/stable/aql/operations-collect.html#grouping-syntaxes