One-to-One Collection Relationships (belongs to) - why is it allowed to select the same record multiple times?

Hello, colleagues and developers!

I created a one-to-one relationship between two collections using the through (reverse) binding function in one of the collections. I noticed that in this case, in the collection where there is a One-to-One (belongs to) relationship, it is possible to select the same record for the relationship multiple times… At the same time, this value is not displayed in the opposite record. If you perform a one-way relationship from the record in the collection where the field has a One-to-One type (has one), then everything works correctly: I can no longer select the value of a record that was previously linked for the relationship.
1-by-1-relations-issue-1 (1)

Please advise, could this be a bug? Or is this how “one-way” relationships work? I assumed that such a connection should work on both sides, i.e., in the opposite collection, it should also not be possible to select an already “taken” record… Maybe I’m doing something wrong? I based my assumption on a simple example: one “Employee” can only have one “User,” and vice versa—one “User” can only have one “Employee.” But in this case, it turns out that the same “User” can have several “Employees,” while one “Employee” can only be connected to one user.

Thank you for reporting the issue. Please wait while we fix it.

1 Like