【发布时间】:2015-01-14 06:05:31
【问题描述】:
我在 java 中查询 ArangoDB 以获取 Arrays 值时遇到问题。 String[] 和 ArrayList 我都试过了,都没有成功。
我的查询:
FOR document IN documents FILTER @categoriesArray IN document.categories[*].title RETURN document
绑定参数:
Map<String, Object> bindVars = new MapBuilder().put("categoriesArray", categoriesArray).get();
categoriesArray 包含一堆字符串。我不确定为什么它没有返回任何结果,因为如果我使用以下方式查询:
FOR document IN documents FILTER "Politics" IN document.categories[*].title RETURN document
我得到了我正在寻找的结果。只是在使用 Array 或 ArrayList 时不会。
我也试过查询:
FOR document IN documents FILTER ["Politics","Law] IN document.categories[*].title RETURN document
为了模拟一个 ArrayList,但这不会返回任何结果。我会使用一堆单独的字符串进行查询,但是太多了,当使用这么长的字符串进行查询时,Java 驱动程序会出错。因此,我必须使用 Array 或 ArrayList 进行查询。
categoriesArray 的一个例子:
["Politics", "Law", "Nature"]
数据库的示例图像:
【问题讨论】: