使用python和AQL,我试图返回一个与给定列表中的任何项匹配的顶点列表。我从数据库得到的当前结果是一个空列表。
python的对等用法如下:
list_of_terms = ["yellow", "blue"]
list_of_vertices = ["yellow", "green"]
terms = [term for term in list_of_terms if term in list_of_vertices]
print(terms)
我尝试的一个AQL查询的示例。
For doc in some_collection
FILTER doc.name==@list_of_terms
RETURN doc
和full函数使用python-arango
bind_vars = {
"lookup_terms": list_of_terms
}
先谢了
qry = "FOR doc IN `{0}` FILTER doc.name== @lookup_terms AND doc.text != null RETURN doc".format(collection_nm)
print(qry)
cursor = db.aql.execute(
qry,
bind_vars=bind_vars,
batch_size=10,
count=True
)
1条答案
按热度按时间u91tlkcl1#
您应该使用
IN
运算子:从文档中:
IN
:测试数组中是否包含值请访问https://www.arangodb.com/docs/stable/aql/operators.html#range-operator
你的python代码将变成: