We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 5bac251 commit 0b8c497Copy full SHA for 0b8c497
1 file changed
server/routes/surveyRoutes.js
@@ -26,10 +26,10 @@ module.exports = app => {
26
})
27
.compact()
28
.uniqBy('email', 'surveyId')
29
- .each(({ email, choice, surveyId }) => {
+ .each(({ surveyId, email, choice }) => {
30
Survey.updateOne(
31
{
32
- id: surveyId,
+ _id: surveyId,
33
recipients: {
34
$elemMatch: { email: email, responded: false }
35
}
@@ -38,8 +38,9 @@ module.exports = app => {
38
$inc: { [choice]: 1 },
39
$set: { 'recipients.$.responded': true }
40
41
- );
42
- });
+ ).exec();
+ })
43
+ .value();
44
45
res.send({});
46
});
0 commit comments