2

    db.collection('session').remove({timestamp:{'$lte':a}},function(err, docs) {
        console.log(err)
        console.log(docs)
    });
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 '$'"
Armen Grigoryan
  • 521
  • 2
  • 9
  • It worked fine when I tried it. Can you edit your question to show an example doc and the contents of `a`. – JohnnyHK Oct 30 '14 at 13:25

2 Answers2

0

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.

-1

Remove the quotes around $lte. It is not a key, but a directive.

Markus W Mahlberg
  • 19,711
  • 6
  • 65
  • 89