繁体   English   中英

带有多个OR的ArangoDB查询?

[英]ArangoDB Query with multiple OR?

我正在使用ArangoDB Java驱动程序,并试图查询包含多个字符串之一的文档,这些字符串存储在列表中的arangoDB文档中。 我在查询中使用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();

“现在”包含很长的时间。 所有其他都是ArrayList<String>. 这将引发错误,说明“ bind parameter '@tags' has an invalid value or type ”。 由于此ArrayList与其他列表没有什么不同,所以我唯一的理论是我输入的逻辑错误。 一个如何查询:

FunctionCondition1 AND (condition2 OR condition3 OR condition4)

绑定变量在查询中使用'@'标记,但给出时没有第一个'@' 集合参数在符号@@处用两个@@myvariablecollection 在这种情况下,bind var为@myvariablecollection并且必须为collection类型。

例如:

FOR a IN @@collection FILTER a.x == @now RETURN a

要求将绑定变量指定为@collectionnow @collection必须命名一个集合,并且now (在此示例中)应该是一个数字。

Map<String, Object> bindVars = new MapBuilder().put("@collection", "myCollection").put("now", 1234).get();

暂无
暂无

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

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