in express remove page ,sort ,limit and fields from req.query
const { page, sort, limit, fields, ...filteredQuery } = req.query;
Explanation:
- Destructuring assignment is used to extract the
page
,sort
,limit
, andfields
properties from thereq.query
object, while the remaining properties are collected into thefilteredQuery
object. - The
page
,sort
,limit
, andfields
properties are removed from thereq.query
object, and the remaining properties are stored in thefilteredQuery
object. ```