leodinas-hao / mongoose-query-parser

Convert url query string to MongooseJs friendly query object including advanced filtering, sorting, population, string template, type casting and many more...
MIT License
68 stars 17 forks source link

OR from query URI #13

Closed innovaweb-dev closed 3 years ago

innovaweb-dev commented 3 years ago

Someone can help me, I want to do a OR from request URI. I tried again and again but without success.

for example (with regex) : customer?$or="[{"key1":"/valu/i"},{"key2":"value2"}]"&active=true

//parse return
{ filter: { '$or': { '$in': [Array] }, active: true } }

Thanks in advance.

aogzpa commented 3 years ago

Hi @rifton007,

you need to enclose it in the filter query string parameter and in JSON format. E.g.: customer?filter={"$or":[{"key1":"/valu/i"},{"key2":"value2"}]}&active=true