如何检查插入到 arangodb collection 的字符串是否已经存在于 collection 中?
how to check whether string inserted to arangodb collection is already present in the collection or not?
在输入问题时,我想检查它是否在 collection 或 not.if 它在 collection return 等式和 result.following 是我的 collection 示例的 json 代码。
[
{
"_key":"292305",
"_id":"example/292305",
"_rev":"_UcMLNR6---",
"Equation":"3+2",
"Question":"Reece has 3 fish. He wants to get 2 more fish. How many fish would he have then?",
"result":5
},
{
"_key":"292490",
"_id":"example/292490",
"_rev":"_UcMM3XO---","Equation":"6+3","Question":"Luke has 6 cars. He buys 3 more cars. How many cars does Luke have now?",
"Result":9
}
]
question=(request.form['question'])
db= client.db('my_db')
jru = db.collection('jru')
result = db.aql.execute('FOR u in jru FILTER u.Question==@question RETURN u',bind_vars={'question':question})
return render_template("o.html",result=result)
在输入问题时,我想检查它是否在 collection 或 not.if 它在 collection return 等式和 result.following 是我的 collection 示例的 json 代码。
[
{
"_key":"292305",
"_id":"example/292305",
"_rev":"_UcMLNR6---",
"Equation":"3+2",
"Question":"Reece has 3 fish. He wants to get 2 more fish. How many fish would he have then?",
"result":5
},
{
"_key":"292490",
"_id":"example/292490",
"_rev":"_UcMM3XO---","Equation":"6+3","Question":"Luke has 6 cars. He buys 3 more cars. How many cars does Luke have now?",
"Result":9
}
]
question=(request.form['question'])
db= client.db('my_db')
jru = db.collection('jru')
result = db.aql.execute('FOR u in jru FILTER u.Question==@question RETURN u',bind_vars={'question':question})
return render_template("o.html",result=result)