简体   繁体   English

AQL 如何返回整个文档而不是单项文档

[英]AQL how to return entire document instead of single item of document

Below is the AQL Query.下面是 AQL 查询。

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

Above query returns only unique mkey list.以上查询仅返回唯一的 mkey 列表。 I want the entire doc to be returned, how can I achieve it?我想要返回整个文档,我该如何实现?

You need to add an INTO clause to the COLLECT operation, like this for example:您需要向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 https://www.arangodb.com/docs/stable/aql/operations-collect.html#grouping-syntaxes

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM