`bluebird@3.5.1`: MongoDB `mongoose@4.13.7` `Promises` library

bluebird@3.5.1: MongoDB mongoose@4.13.7 Promises library > Warning: a promise was created in a handler > at internal/process/next_tick.js:180:9 but was not returned from it, > see http://goo.gl/rRqMUw > at model.Query.ret [as execAsync] > (eval at makeNodePromisifiedEval > (/home/bike/github/SmartPlug-Foodtruck.kr/node_modules/bluebird/js/release/promisify.js:184:12), <anonymous>:8:21) > mongoose Promises : bluebird http://mongoosejs.com/docs/promises.html Built-in Promises Mongoose async operations, like .save() and queries, return Promises/A+…

Read More

[mongoose] update and delete embedded document in array

Update: var comment = blog.comments.id(comment_id); comment.author = ‘Bruce Wayne’; blog.save(function (err) { // emmbeded comment with author updated }); Delete: Blog.findByIdAndUpdateAsync(blogId, { $pull: { comments: {_id: commentId}} }) .then(blog => { res.status(200).json(‘Comment is deleted successfully.’); }) .catch(err => { console.error(err); res.status(500).json(err.message || err); });

Read More