Thanks for the update Tim.
My trial and error to get this work went down the route of dealing with the junction collection directly. The following is what I'm using to remove a tag/category in a m2m relationship between Items and Categories
`
let filterData = {
'items_item_id': {
'_eq': item_id
},
'categories_cat_id': {
'_eq': req.body.cat_id
}
}
let parsedFilter = qs.parse(filterData);
// Find the id of the junction collection
// that matches both the item and cat ids
itemCatJunctionService // ItemService for junction collection
.readByQuery({
filter: parsedFilter
})
.then((results) => {
let junction_id = results[0].id;
itemCatJunctionService
.deleteOne(junction_id)
})`
This, on the surface, appears to work as I intended. I'm getting the results I expect.
Before I commit to this, can I ask is there anything (potentially) wrong, with using this method? i.e. calling readByQuery and deleteOne on the junction collection directly rather than through updating the items or categories fields?
Perhaps of interest, but when I used 'readOne' instead of 'readByQuery' I was getting a 'you do not have permission to access this' error. It may be something further back in my own code but I was wondering is there any obvious reason I'd get this error when authenticating as an admin with all permissions?