Mongoose instance .save() not working

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!

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)