feathers icon indicating copy to clipboard operation
feathers copied to clipboard

"Invalid query parameter $all" and "Unknown operator: $and"

Open lassschr opened this issue 5 years ago • 1 comments

Hello,

I am trying to query documents in a collection based on an array of strings where I want to check if it is containing certain values. I am using mongodb/mongoose and I have tried using $all/$and. I would prefer to be using $all in this example, but upon the error I gave $and a try.

The expected behavior is a response within an Angular app with documents living up to this query. The error occurs when this throws an error stating: "Invalid query parameter $all" / "Unknown operator: $and"

query: { residence: { facilities: { $all: [ "dishwasher", "furnished" ] } } }

NodeJS version: v14.15.1

Operating System: Windows 10

Browser Version: Google chrome 91.0

Angular Version: 11.0.2

lassschr avatar Mar 13 '21 23:03 lassschr

You must whitelist the operators in the service options for them to works.

https://docs.feathersjs.com/api/databases/common.html#service-options

J3m5 avatar Mar 14 '21 08:03 J3m5