Skip to content

Commit a2a3b8b

Browse files
committedNov 5, 2015
fix; issue with fix for #3535
1 parent 171e694 commit a2a3b8b

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed
 

‎lib/document.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -505,7 +505,8 @@ Document.prototype.set = function(path, val, type, options) {
505505
if ('real' === pathtype || 'virtual' === pathtype) {
506506
// Check for setting single embedded schema to document (gh-3535)
507507
if (this.schema.paths[pathName] &&
508-
this.schema.paths[pathName].$isSingleNested) {
508+
this.schema.paths[pathName].$isSingleNested &&
509+
path[key] instanceof Document) {
509510
path[key] = path[key].toObject({ virtuals: false });
510511
}
511512
this.set(prefix + key, path[key], constructing);

0 commit comments

Comments
 (0)
Please sign in to comment.