Skip to content

Commit

Permalink
clean up conflicting mods test
Browse files Browse the repository at this point in the history
  • Loading branch information
aheckmann committed Dec 15, 2011
1 parent 6809a58 commit 8058adb
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 18 deletions.
19 changes: 3 additions & 16 deletions lib/schema/documentarray.js
Expand Up @@ -116,22 +116,9 @@ DocumentArray.prototype.cast = function (value, doc, init, prev) {
delete subdoc._doc._id;
value[i] = subdoc.init(value[i]);
} else {

if (subdoc = prev && prev.id(value[i]._id)) {
var val = value[i];
value[i] = subdoc;
subdoc.parentarray = value;
subdoc.parent = value._parent;
subdoc.set(val);
} else {
subdoc = new this.caster(null, value);
value[i] = subdoc.set(value[i]);
}

//console.error('existing', prev && !!prev.id(value[i]._id));
//subdoc = prev && prev.id(value[i]._id) ||
//new this.caster(null, value);
//value[i] = subdoc.set(value[i]);
subdoc = prev && prev.id(value[i]._id) ||
new this.caster(null, value);
value[i] = subdoc.set(value[i]);
}
}
}
Expand Down
2 changes: 0 additions & 2 deletions test/types.array.test.js
Expand Up @@ -493,8 +493,6 @@ module.exports = {
x[2] = n[1];
d.em1 = x.filter(Boolean);

//mongoose.set('debug', true);

d.save(function (err) {
should.strictEqual(null, err);
D.findById(d, function (err, d) {
Expand Down

0 comments on commit 8058adb

Please sign in to comment.