To remove created associations you can just call the set method without a specific id:
// remove the association with task1
project.setTasks([task2]).then(associatedTasks => {
// you will get task2 only
})
// remove 'em all
project.setTasks([]).then(associatedTasks => {
// you will get an empty array
})
project.removeTask(task1).then(() => {
// it's gone
})
// and add 'em again
project.addTask(task1).then(() => {
// it's back again
})
For hasOne/belongsTo it's basically the same:
When getting data on an association that has a custom join table, the data from the join table will be returned as a DAO instance:
u.getProjects().then(projects => {
const project = projects[0]
if (project.UserProjects.status === 'active') {
// .. do magic
// since this is a real DAO instance, you can save it directly after you are done doing magic
return project.UserProjects.save()
})