Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

NodeJS mongoClient invalid operator: $eq

I have a mongo property (category), where I want to filter with equals. I used the following syntax:

{"category":{"$eq":"cat1"}}

(I know, it can be written like:

{"category":"cat1"}

If I use the $eq operator, the mongoClient fails with "invalid operator: $eq". But only on localhost. If I deploy the same code to a remote server, it works perfectly.

How can I make it work on localhost? It would be preferred to use the $eq operator - there are many places in the code where this is used.

Thx

like image 589
SzaboAdam Avatar asked Feb 11 '23 20:02

SzaboAdam


1 Answers

The $eq query operator was introduced in version 3.0, but it seems to also work on my local 2.6.7 install.

So you likely just need to update your local install.

like image 108
JohnnyHK Avatar answered Feb 20 '23 22:02

JohnnyHK