Reference field to various collections

Hello all,

I would like to have a Reference Field in one collection that could reference various types of collections. That is, on the same Reference field in collection A, I would like to have the possibility to have a reference to an object of collection B, and a reference to an object of collection C for the same field on another row.

When I create a reference field, it is required to specify the “referenced collection”, but I don’t know if I could just put there any object I want. Is this possible?

A workaround I am considering is to have the field to be of type string and put directly the “_id” value in there of any object, although I would really prefer using the built-in Wix solution of Reference fields.

Has anyone encountered any solution to this?

Thanks!

A reference field can connect to one collection only. it doesn’t make sense to connect it to more than one collection. what are you trying to achieve?

Actually, I can see some situations where you’d may wish to connect it to different collections, but it’s not possible.
Maybe if you add some details about what exactly you’re trying to do, someone will have a solution.

Yeah, I have a shop with different type of goods that can be awarded to certain users, and I would like to have a reference to the specific good that is awarded, but those goods are of different type and therefore, they are classified in different collections.
So I would like my reference field to be assigned to the good indistinctly of its kind. That is, connect it to different collections.

Thank you very much for your answer!

As far as I know it’s not possible. Maybe you should save them as JSON, and use it to query the other collections.

Have faced a similar issue and in the end understood that it doesn’t make sense to connect it to more than one collection