Skip to content

Commit

Permalink
test(update): repro #9298
Browse files Browse the repository at this point in the history
  • Loading branch information
vkarpov15 committed Aug 28, 2020
1 parent cc32a0e commit 6e36991
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions test/model.update.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -3128,6 +3128,25 @@ describe('model: updateOne: ', function() {
});
});

it('updating a map path underneath a single nested subdoc (gh-9298)', function() {
const schema = Schema({
cities: {
type: Map,
of: Schema({ population: Number })
}
});
const Test = db.model('Test', Schema({ country: schema }));

return co(function*() {
yield Test.create({});

yield Test.updateOne({}, { 'country.cities.newyork.population': '10000' });

const updated = yield Test.findOne({}).lean();
assert.strictEqual(updated.country.cities.newyork.population, 10000);
});
});

it('overwrite an array with empty (gh-7135)', function() {
const ElementSchema = Schema({
a: { type: String, required: true }
Expand Down

0 comments on commit 6e36991

Please sign in to comment.