Day 73, God bless upsert

Trying to clean up the mongoDb code I wrote. Solved a bug by using upsert….

The problem I had might be related to this StackOverflow question:
http://stackoverflow.com/a/7855281/1239621

I don’t know why the other method is not working. But the solution presented in the SO was working. Basically, you want to do:

User.update({_id: input_id}, inputData, {upsert:true}, function(error,data){})
Advertisements
Standard