overlookmotel / sequelize-hierarchy

Nested hierarchies for Sequelize
MIT License
302 stars 90 forks source link

Retrieve all structure when child is returned? #222

Closed LucasBremm closed 4 years ago

LucasBremm commented 4 years ago

Is there a way to return all the structure (parent -> child -> grandchild) by making a query that returns the child or grandchild? Everytime this happens I get and error that I did not found a way to treat by now, and all I need is to return the hole structure independent of the level of hierarchy where the condition got.

overlookmotel commented 4 years ago

Hi. I don't really understand your question. Would you like to post the code which is giving you an error? Or an example of data in the table and what result you're expecting to get from your query?

LucasBremm commented 4 years ago

I actually solved it using another strategy, sorry to bother and for the delay to answer you. What I wanted was to get parent and child from an object in the "middle". What I ended up doing was getting the object, searching for the father and getting the descendants.