I have a problem with Mongoose and MongoDb
It is very interesting that only Model.update
works and save
never works and does not even fire
I have the same problem. my problem was about changing an array inside db, then when I try to use .save(), it didn't understand that I changed any thing, then the .save() didn't work. I just use markModified() before use .save() and my problem become solved.
this is my code with problem: (not working)
club.members[index].name = new_name;
club.save();
this is my solved code: (working)
club.members[index].name = new_name;
club.markModified('members');
club.save();
enjoy!