Skip to content

Commit

Permalink
repro; #3535
Browse files Browse the repository at this point in the history
  • Loading branch information
vkarpov15 committed Nov 4, 2015
1 parent b3472ac commit ce11be0
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion test/document.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2058,6 +2058,24 @@ describe('document', function() {

var gnr = new Band({ leadSinger: { name: 'Axl Rose' } });
assert.equal(gnr.leadSinger.firstName(), 'Axl');
done();
db.close(done);
});

it('single embedded schemas with models (gh-3535)', function(done) {
var db = start();
var personSchema = new Schema({ name: String });
var Person = db.model('gh3535_0', personSchema);

var bandSchema = new Schema({ leadSinger: personSchema });
var Band = db.model('gh3535', bandSchema);

var axl = new Person({ name: 'Axl Rose' });
var gnr = new Band({ leadSinger: axl });

gnr.save(function(error, doc) {
assert.ifError(error);
assert.equal(gnr.leadSinger.name, 'Axl Rose');
db.close(done);
});
});
});

0 comments on commit ce11be0

Please sign in to comment.