mirror of
https://github.com/vale981/Vulcan
synced 2025-03-06 18:11:40 -05:00
when deleting a category, $unset all its children's parentId
This commit is contained in:
parent
edfd8f4666
commit
153e7d9c37
1 changed files with 3 additions and 0 deletions
|
@ -10,6 +10,9 @@ Meteor.startup(function () {
|
|||
e.preventDefault();
|
||||
if (confirm("Delete category?")) {
|
||||
Categories.remove(instance.data._id);
|
||||
Categories.find({parentId: instance.data._id}).forEach(function (category) {
|
||||
Categories.update(category._id, {$unset: {parentId: ""}})
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
Loading…
Add table
Reference in a new issue