I’m working with a database that has a many-to-many relationship between ‘Users’ and ‘Devices.’
I have set up a form that allows a user to give a new name to a device (that already exists as a record in the devices collection) and then add that device to said user.
I have tried two approaches:
- The form is tied to the ‘Devices’ data collection - the issue here is I am not able to update the device, I can only create a new one. In this case, I’d like to provide Device ID and Device name as input fields and update this device to be added to the logged-in user.
- The form is tied to the ‘Users’ data collection - the issue here is the Device ID is the only relevant field to adjust (there is no option to change the device name from here) and there are no action options under updating the user that I can find that allow me to add a device (by device_id) to the logged-in users’ record.
It seems to be that linking the form to the ‘Devices’ collection is easier, as it has all the necessary form fields, and I can easily add a user to a device manually while editing my records in the database. I just want to be able to perform that action through this form’s button. Any help with how to set this action up is much appreciated.