Quantcast
Viewing all articles
Browse latest Browse all 3

Answer by aciddaniel for Update on MongoDB from NodeJS doesnt work

Problem I had was items ID, if you'll try to log the message you'll get an error saying something about uniqueness about ID blah bla :) so what I did was I saved id of existing item, then deleted it before the update gets called. Same thing was suggested by mongodb devs. so your code would look like:

id = item._iddelete item._idcollection.update(_id: id, item, function(err, updated){...}

Hope that'll help. And I also would recommend to use Mongoose.


Viewing all articles
Browse latest Browse all 3

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>