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

fix: exclude blacklisted keys from JSON filter #17

Closed aogzpa closed 3 years ago

aogzpa commented 3 years ago

Fixes #16

Before this commit, blacklist excluding filter works only in the properties passed as query parameters, but it can be bypassed including them in the JSON filter query parameter.

This commit adds a recursive function that deletes the given keys and sanitizes arrays with empty objects.