Answer the question
In order to leave comments, you need to log in
How to update populated fields?
Is it possible to change the data in a related document?
Something like this:
User.findById(id).populate('profile').exec(function(err, user) {
user.profile.description = newDescription;
user.save();
});
Answer the question
In order to leave comments, you need to log in
Maybe so?
User.findById(id).populate('profile').exec(function(err, user) {
Profile.findOneAndUpdate({ _id: user.profile }, { description: newDescription });
user.save();
});
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question