【发布时间】:2020-08-05 00:18:36
【问题描述】:
使用 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
以及使用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
)
【问题讨论】: