I refactored link() and unlink() to use AR methods when we have relation via ActiveRelation to not depend on db commands in this case.
This way we do not need to overwrite link() and unlink() in noSQL implementations as the insert() update() and delete() are already doing the right job.
viaTable is not supported in noSQL AR so we do not have the case that $relation->via is not an array.