Invalid NodeJS mongoClient statement: $ eq

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

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

(I know it can be written like this:

{"category":"cat1"}

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

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

thank

+4
source share
1 answer
+8

All Articles