Second collection of the same record

Hi,

Is it possible to create a second collection hitting the same table as another collection?
If so, what do I need to do?
What will be shared between the collection and what will not?

For example, I need the same models hooks on both collection.

I need to do that because I can’t have differents summary views inside a collection while my segments require different views.

Cheers,

Hi again, @mathieuh

I firstly consider you need: I need to have a different summary view for each segment of my collection.
This looks to be an interesting feature request. I create it on our board to take it into account.

About the workaround: Is it ok to duplicate a collection? The answer is yes:

  • It’s technically possible to have two separated Sequelize collections targeting the same table.
    • to do that you can clone the model file and give another name to the collection. (to share hooks, you will certainly prefer to share the hooks functions in a separated file to keep one copy)
  • On the forest side, the collection id is the name. A fresh and isolated layout will be attached to the new collection at its creation.

Ok thanks, I’ll try this and come back to you if I have further questions.

1 Like