Skip to content

Commit

Permalink
bug fix: clicking on notification link after adding a track leads to …
Browse files Browse the repository at this point in the history
…/u/undefined. related to #54. closes #61.

the bug was caused by a breaking change in mongodb driver’s returned object: the saved data object is now stored as the first element of a `ops` array property.
  • Loading branch information
adrienjoly committed Jul 15, 2017
1 parent b7aebcd commit c6e001b
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion whydJS/app/models/post.js
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,11 @@ exports.savePost = function (postObj, handler) {
});
}
else
mongodb.collections["post"].insert(postObj, whenDone);
mongodb.collections["post"].insertOne(postObj, function(error, result) {
if (error)
console.log("update error", error);
whenDone(error, error ? {} : result.ops[0]);
});
}

var fieldsToCopy = {
Expand Down

0 comments on commit c6e001b

Please sign in to comment.