Created
September 7, 2018 17:28
-
-
Save vanya2h/8bc845358a16311064d4ef51cb2671bf to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var Parent = mongoose.model('Parent', parentSchema); | |
var parent = new Parent({ children: [{ name: 'Matt' }, { name: 'Sarah' }] }) | |
parent.children[0].name = 'Matthew'; | |
// `parent.children[0].save()` is a no-op, it triggers middleware but | |
// does **not** actually save the subdocument. You need to save the parent | |
// doc. | |
parent.save(callback); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment