Skip to content

Commit 67d0b87

Browse files
committed
Merge pull request #543 from YannickDa/master
Add extra props on associations to delete
2 parents 3cb0559 + bea845d commit 67d0b87

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

lib/Drivers/DML/mongodb.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,13 @@ Driver.prototype.hasMany = function (Model, association) {
316316
pull[association.name] = [];
317317

318318
for (var i = 0; i < Associations.length; i++) {
319-
pull[association.name].push({ _id: Associations[i][association.model.id] });
319+
var props = {_id: Associations[i][association.model.id]};
320+
321+
if (Associations[i].extra !== undefined) {
322+
props = _.merge(props, _.pick(Associations[i].extra, _.keys(association.props)));
323+
}
324+
325+
pull[association.name].push(props);
320326
}
321327

322328
return db.update({

0 commit comments

Comments
 (0)