`export const getAllJobs = catchAsyncError(async (req, res, next) => {
const { city, niche, searchKeyword } = req.query;
const query = {};;
if (city) {
query.location = city;
}
if (niche) {
query.jobNiche = niche;
}
if (searchKeyword) {
query.$or = [
{ title: { $regex: searchKeyword, $options: "i" } },
{ companyName: { $regex: searchKeyword, $options: "i" } },
{ introduction: { $regex: searchKeyword, $options: "i" } },
];
}
const jobs = await Job.find(query);
res.status(200).json({
success: true,
jobs,
count: jobs.length,
});
});`
I’m getting all the jobs from the database but my query function doesn’t work