简体   繁体   English

如何避免ArangoDB中的AQL冲突?

[英]How to avoid conflict with AQL in ArangoDB?

I am using AQL to update records in a collection. 我正在使用AQL来更新集合中的记录。 Sometimes, I get [ArangoError 1200: conflict]. 有时,我得到[ArangoError 1200:冲突]。 In JS Shell I can set the 3rd parameter as true to use overwrite and ignore the conflict. 在JS Shell中,我可以将第3个参数设置为true以使用覆盖并忽略冲突。 How do I ignore conflict in AQL? 如何忽略AQL中的冲突?

Though I am not sure what causes the conflict, many query errors can be turned off by appending the directive OPTIONS { ignoreErrors: true } to the UPDATE part of the query. 虽然我不确定导致冲突的原因,但可以通过将指令OPTIONS { ignoreErrors: true }附加到查询的UPDATE部分来关闭许多查询错误。

For example, the following original query 例如,以下原始查询

FOR doc IN collection
  FILTER doc.value == 'someValue'  
  UPDATE doc WITH { count : doc.count + 1 } IN collection

would be adjusted to 将调整为

FOR doc IN collection
  FILTER doc.value == 'someValue'  
  UPDATE doc WITH { count : doc.count + 1 } IN collection OPTION { ignoreErrors: true }

Though suppressing errors may hide relevant issues that exist in a query, so I wouldn't recommend it in general. 虽然抑制错误可能会隐藏查询中存在的相关问题,但我不建议这样做。

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

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