I'm currently attempting to filter out all objects from the projects array that do not appear in the savedProjects array, but I'm ending up with an empty result. Could it be that I am approaching the filtering process incorrectly?
Here's my code snippet:
router.post('/get-related', async (req, res) => {
console.log(req.body);
try {
const projects = await Projects.find({researchers: req.body.fullname});
let savedProjects = await Projects.find({projectID: req.body.projectsIDs});
projects.filter(p => savedProjects.includes(p) === false);
res.json(projects);
} catch (err) {
console.log(err);
res.json({ message: err }) };
});