I have two collection types in Strapi, created with many-to-many relation. What is the proper way to write a custom query to update only the relation?
**user**
id name
1 user1
**store**
id name
1 store1
**user_saved_stores__stores_saved_users**
id user_id store_id
1 1 1
I can use the default PUT API to update the relation like this, but I would need to find out every single user before calling the API, as it would overwrite all the many-to-many relations.
const xhr = new XMLHttpRequest();
xhr.open('PUT', '/stores/1', true);
xhr.setRequestHeader('Content-Type', 'application/json');
xhr.send(
JSON.stringify({
savedUser: ["1","2"],
})
);
If I would like to add or remove only one user to the relations, what should be the best way without writing custom SQL query?