简体   繁体   English

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

[英]how to check whether string inserted to arangodb collection is already present in the collection or not?

while inputing a question,I want to check whether it is in the collection or not.if it is in the collection return the equation and result.following is json code of my collection example.在输入问题时,我想检查它是否在集合中。如果它在集合中,则返回方程和结果。以下是我的集合示例的 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.

相关问题 如何检查一个集合中的键值对是否匹配并使用 python 更新另一个 mongodb 集合中存在的键中的值 - 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 正则表达式检查字符串中是否存在一个或多个特殊字符 - Regular expression to check whether one or more special characters are present in string 如何将Complex Collection转换为String? - How to convert Complex Collection to String? pymongo:如何通过名称作为字符串访问MongoDB集合? - pymongo: how to access MongoDB collection by name as string? 如何将整个集合中的int字符转换为字符串? - How to convert a string with characters in the int for the entire collection? 如何检查字符串是否出现在非字母数字的列中? - How to check if character string is present in column that is not alphanumeric? 如何将一个数据帧与另一个数据帧进行比较并检查第二个 df 中是否存在第一个 df 中的相同数据 - How to compare one dataframe with another and check whether the same data in first df present in second df 如何使用 python 检查 JSON 数据中是否存在数据库中的逗号分隔值 - how to check whether the comma-separated value in the database is present in JSON data or not using python 如何使用python识别另一个字符串之后是否存在特定字符串 - How to identify whether a specific string present after another string using python SQLAlchemy:检查表中是否已存在对象 - SQLAlchemy: Check if object is already present in table
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM