janez89 / mongoose-materialized

mongoose materialized plugin
59 stars 22 forks source link

No "re-parenting" occurres when parentId is assigned a null value #5

Closed vklap closed 10 years ago

vklap commented 10 years ago

Hi Janez,

Thanks a lot for this great module :)

It would be nice if you could fix the following bug:

When I assign null to the parentId (i.e. when the specific item should not have any parent anymore - item.parentId = null), then there is no re-arrangement of the hierarchical structure (i.e. no "re-parenting").

The current workaround might be using the "remove" method - which is much less intuitive, and requires to either save the state of the previous parent Id, or to compare the current and previous parent Id values - before saving the item.

Thanks, Victor

janez89 commented 10 years ago

Hy Victor,

Thank you for your feedback, I fixed this bug. Use npm tool for upgrade.

I plan to refactor this plugin.

Thanks, Janos.

vklap commented 10 years ago

Hi Janos,

Thanks a lot for the fix.

To be honest, as I needed this functionality as quick as possible + some additional features (such as getting a hierarchical tree, with a limitation on the returned depth), I've written a module of my own - which I intend to publish as an npm module in the near future.

Anyway, the open source community will enjoy from the fruit of our labor - which is great.

Thanks a lot - once again :) Kind regards, Victor

2014-07-30 19:12 GMT+03:00 Janez notifications@github.com:

Hy Victor,

Thank you for your feedback, I fixed this bug. Use npm tool for upgrade.

I plan to refactor this plugin.

Thanks, Janos.

— Reply to this email directly or view it on GitHub https://github.com/janez89/mongoose-materialized/issues/5#issuecomment-50637602 .

janez89 commented 10 years ago

Hy Victor,

I am glad if I could help. :) Good luck for your Project.

Janos.