const dateFilter = asyncHandler(async (req, res) => { const month = 6; const day = 10; const feedbacks = await Feedback.find({ $expr: { $or: [ { $eq: [{ $month: "$birthday" }, month], $eq: [{ $dayOfMonth: "$birthday" }, day], }, { $eq: [{ $month: "$anniversary" }, month], $eq: [{ $dayOfMonth: "$anniversary" }, day], }, ], }, }); console.log({ feedbacks }); });
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter