Skip to content
Advertisement

Feathers-mongoose $like query for MongoDb getting Error

I have the following Mongoose Schema –

JavaScript

Note that, both of them are String. I was trying to do a query like the following –

JavaScript

I have rows with Javascript in Category column. But getting the following error-

JavaScript

Advertisement

Answer

I know its been a while since this was discussed, but I’ve had a similar question and the code provided by @Daff helped me a lot, but it contains an error.

query[field].$like is checked for presence, but then query[field].$search is attached to the final query.

The correct code representation (if following the original question) should be:

JavaScript
User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement