You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The code example I gave is fake. Here is a real example:
var postSchema = {
title: String,
answers: [{
details: String,
stats: {
votes: Number,
count: Number
}
}]
};
// later on in code
post.findOneAndUpdate(
{ _id: somePostId, answers._id: someAnswerId },
{ $set: { 'answers.$': { details: 'blah', stats: { votes: 1, count: 3 }}}}
);
So, in this example in 4.1.2 details is correctly updated to blah, but the stats field is completely removed from the answer. Even if there was a value in there before, its like stats was $unset or something. In 4.0.6, the details and stats are set correctly.
When I do this in mongoose 4.1.2:
field1 is updated, but field2 is not. When I downgrade to mongoose 4.0.6 this works fine.
The text was updated successfully, but these errors were encountered: