How to change what field to use for "Relation field"

When adding a relation field in a collection, it’s not clear how I can point it out to a specific field. For instance, I have a collection called “Booking” that should also contain the userID or username of the user who made the booking. Instead of adding a regular field, I added a “relation field”.

  1. is it accurate to say that any relation field added, will add a new relation field in the other collection?
  2. is it better to use relation field or instead use a text field that stores the value?
  3. how would using relations help (or make it more complicated) when deleting a record from one of the collections?

I wonder if you have any insights you can share @sunnyson @DMehaffy

  • not always, it depends on the type of relation and which side you are on.
    • oneWay and manyWay do not create relational fields on their “target” model (noted by the - in the field name)
    • oneToMany, manyToOne, and manyToMany all create fields on both sides
  • relations are generally best but depends on the use-case
  • there is nothing specific about using relations that make things more difficult during deletion unless you need cascading delete. In which case you would need to make multiple requests to continue down however far you need to delete. We don’t currently have cascading delete methods.