简体   繁体   English

ArangoDB验证查询

[英]ArangoDB verifiying query

So I have an ArangoDB query here, but it throws an error while executed. 因此,我在这里有一个ArangoDB查询,但执行时会引发错误。 It says syntax error and then says the error is somewhere around adminEdge._from but I can't find what the problem is : 它说语法错误,然后说该错误在adminEdge._from附近,但我找不到问题所在:

let query = aql`
  FOR user IN ${users}
  FILTER user._key == ${body.userKey}
  FOR adminEdge IN ${administrates}
  FILTER adminEdge._from == user._id
  LIMIT 1
  RETURN { accountId: adminEdge._to, user }`;

users and administrates comes from db.collection that comes with ArangoDB. usersadministrates来自ArangoDB附带的db.collection body is an object that is passed in as a parameter. body是作为参数传递的对象。

I'm pretty new to AQL so maybe I'm making some basic errors 我是AQL新手,所以也许我在犯一些基本错误

由于要返回多个列,因此不能仅返回用户,就必须像列出adminEdge._to一样列出其列。

Camba is right, your return value is not valid. Camba是正确的,您的返回值无效。

You could try something like 您可以尝试类似

FOR user IN ${users}
  FILTER user._key == ${body.userKey}
  FOR adminEdge IN ${administrates}
      FILTER adminEdge._from == user._id
      LIMIT 1
      RETURN MERGE({accountId: adminEdge._to},user)

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

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