suppose we have a front end where user can select different filters to narrow down the query results.In this case it is not already known which all fields user will select.
A dynamic query for this case can be constructed using this trick:
here fieldNames is the array containing names of all filters and fields is the array containing values provided by user.
A dynamic query for this case can be constructed using this trick:
here fieldNames is the array containing names of all filters and fields is the array containing values provided by user.