[英]ArangoDB Query with multiple OR?
I am using the ArangoDB java driver and am trying to query for documents containing one of a number of Strings, which are stored in the arangoDB documents in lists. 我正在使用ArangoDB Java驱动程序,并试图查询包含多个字符串之一的文档,这些字符串存储在列表中的arangoDB文档中。 I am using ArrayList with a list of Strings in the query. 我在查询中使用ArrayList和字符串列表。
Query:
FOR document IN documents FILTER ( @now - document.dateAdded < 2592000000 ) &&
(document.categories IN @categories || document.tags IN @tags
|| document.locations IN @locations ) RETURN document
Map<String, Object> bindVars = new MapBuilder().put("now", now).put("categories", categories).put("@tags", tags).put("@locations", locations).get();
"now" contains a long. “现在”包含很长的时间。 All the others are ArrayList<String>.
所有其他都是ArrayList<String>.
This is throwing an error explaining that " bind parameter '@tags' has an invalid value or type
". 这将引发错误,说明“ bind parameter '@tags' has an invalid value or type
”。 Since this ArrayList is no different than the others, my only theory is that I am inputting the logic incorrectly. 由于此ArrayList与其他列表没有什么不同,所以我唯一的理论是我输入的逻辑错误。 How does one query for: 一个如何查询:
FunctionCondition1 AND (condition2 OR condition3 OR condition4)
The bind vars are marked in the query using '@'
, but they are given without the first '@'
. 绑定变量在查询中使用'@'
标记,但给出时没有第一个'@'
。 A collection parameter is specified with two at symbols @@
as @@myvariablecollection
. 集合参数在符号@@
处用两个@@myvariablecollection
。 In this case the bind var is @myvariablecollection
and must be of type collection. 在这种情况下,bind var为@myvariablecollection
并且必须为collection类型。
For example: 例如:
FOR a IN @@collection FILTER a.x == @now RETURN a
requires the bind variables to be given as @collection
and now
where @collection
must name a collection and now
should be (in this example) a number. 要求将绑定变量指定为@collection
, now
@collection
必须命名一个集合,并且now
(在此示例中)应该是一个数字。
Map<String, Object> bindVars = new MapBuilder().put("@collection", "myCollection").put("now", 1234).get();
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.