Skip to content

Commit 546ee8b

Browse files
committed
execute query
1 parent a358c12 commit 546ee8b

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

server/routes/surveyRoutes.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,10 @@ module.exports = app => {
2626
})
2727
.compact()
2828
.uniqBy('email', 'surveyId')
29-
.each(({ email, choice, surveyId }) => {
29+
.each(({ surveyId, email, choice }) => {
3030
Survey.updateOne(
3131
{
32-
id: surveyId,
32+
_id: surveyId,
3333
recipients: {
3434
$elemMatch: { email: email, responded: false }
3535
}
@@ -38,8 +38,9 @@ module.exports = app => {
3838
$inc: { [choice]: 1 },
3939
$set: { 'recipients.$.responded': true }
4040
}
41-
);
42-
});
41+
).exec();
42+
})
43+
.value();
4344

4445
res.send({});
4546
});

0 commit comments

Comments
 (0)