Hello everyone
I would like to recover the votes in my function “Test”
Can someone guide me?
thank you
function test(vote) {
console.log('I want to collect your vote here', vote);
return 0
}
exports.global = (req, res) => {
let edition;
edition = { vote: (test({ vote })) };
const update = { $set: edition };
/* const update = { $set: edition }; */
const id = req.params.id;
const filter = {};
const options = {
upsert: true,
new: true
};
Project.updateMany(filter, update, options, (err, response) => {
if (err) return res.status(500).json({ msg: 'update failed', error: err });
res.status(200).json({ msg: `document with id ${id} updated`, response: response });
});
};