APIFeatures
APIFeatures class represents a utility for manipulating and filtering API queries.
Constructor:
query
: The mongoose query object.queryString
: The query string object.
Methods:
filter()
- Description: Filter the query based on the provided query string.
- Returns: The modified APIFeatures object.
search()
- Description: Perform a text search on the query using the provided search term.
- Returns: The modified APIFeatures object.
limitFields()
- Description: Limit the fields returned in the query result.
- Returns: The modified APIFeatures object.
paginate()
- Description: Paginate the query result.
- Returns: The modified APIFeatures object.
sort()
- Description: Sort the query result.
- Returns: The modified APIFeatures object.