繁体   English   中英

如何检查插入到arangodb集合中的字符串是否已经存在于集合中?

[英]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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM