objection.js icon indicating copy to clipboard operation
objection.js copied to clipboard

Can unrelate unrelated a given instance?

Open mmmmmrob opened this issue 2 years ago • 0 comments

Confused about unrelate :( In the docs I can use relate to connect two instances like this:

const actor = await Person.query().findById(100);
const movie = await Movie.query().findById(200);
await actor.$relatedQuery('movies').relate(movie);

I had expected to be able to unrelate the same way:

const actor = await Person.query().findById(100);
const movie = await Movie.query().findById(200);
await actor.$relatedQuery('movies').unrelate(movie);

That doesn't seem to be possible. Am I missing something?

mmmmmrob avatar Oct 14 '22 16:10 mmmmmrob