[英]How to check if a key value pair is matching in one collection and update the value in the key present in another mongodb collection using python
[英]how to check whether string inserted to arangodb collection is already present in the collection or not?
在輸入問題時,我想檢查它是否在集合中。如果它在集合中,則返回方程和結果。以下是我的集合示例的 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)
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.