节点js mongodb删除错误“键$ lte不能以'$'开头" [英] node js mongodb remove error "key $lte must not start with '$'"
问题描述
db.collection('session').remove({timestamp:{'$lte':a}},function(err, docs) {
console.log(err)
console.log(docs)
});
版本mongodb为2.6.5,当我从Robomongo视觉管理器进行此查询时,它可以正常工作,但是从节点js抛出错误键$ lte不能以'$'开头"
Version mongodb is 2.6.5, when I make this query from Robomongo visual manager it works normally but from node js it throws error "key $lte must not start with '$'"
推荐答案
我也遇到了类似的问题,一些已下载的代码外壳可以正常工作,但是Node驱动程序失败了(没有其他外部库,例如mongoose).我安装的MongoDB版本为2.6.6,package.json的mongodb条目为〜1.3.18".在某人的建议下,我将输入值更改为〜1.4.31",这解决了我的问题.
I also faced similar issue with some downloaded code- shell worked properly but Node driver failed (there was no other external library like mongoose). My installed MongoDB version was 2.6.6 and the package.json had a mongodb entry as "~1.3.18". With a suggestion from someone, I changed the entry value to "~1.4.31" which resolved my problem.
这篇关于节点js mongodb删除错误“键$ lte不能以'$'开头"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!