в node.js с Express, как удалить строку запроса
import Tour from '../model/TourModel.js'
function getAllTours= async(req,res)=> {
//we cann't directly in variable cause it will refrence and not copy and delete of that variable delete that object
const queryObj = { ...this.queryString };
const excludedFields = ['page', 'sort', 'limit', 'fields'];
//we use forEach cause we don't want to return the array
//
excludedFields.forEach(el => delete queryObj[el]);
const tours= await Tour.find({queryObj});
}
Sab Tech