对不起,我的英语不是我的母语
这是我在Nedb中的数据库,我对密钥“ const”感到“恐惧”,但我不认为这是我的问题,实际上,密钥是固定的,我无法更改
{
"data":
{
"id": 75307,
"name": "peperoni",
"creator_id": 3441711,
"created": 1515849498,
"updated": 1534616226,
"const": 4,
},
"userVote": -1,
"timestamp": 1535057921,
"mytable": "media",
"_id": "z4hwARVWqWH0dJti"
}
这是我的代码
function find(thename, theconst) {
var q = [
{'data.name': thename },
{'data.const': theconst }, // If i delete this line, works
{'mytable': 'media' },
]
nedb.findOne({
$and: q
}, (err, doc) => {
if (doc) {
console.log("found!")
}
console.log("not found!")
})
}
我尝试用“ 4”像字符串和数字一样调用函数... 总是得到“未找到!”
find("peperoni", "4")
find("peperoni", 4)
我阅读了文档,但无法解决