[v5] Cannot populate multiple relations to the same table using the REST API and Document Service API #20330
Labels
issue: bug
Issue reporting a bug
severity: medium
If it breaks the basic use of the product but can be worked around
source: core:core
Source is core/core
source: core:database
Source is core/database package
status: pending reproduction
Waiting for free time to reproduce the issue, or more information
version: 5
Bug report
Describe the bug
I have a table that has two different relation fields with the same table. So in table
Property
I have the following:contracts
is a field with thebelongs to many
relationactive_contract
is a field withhas one
relationThe problem is that when I use the REST API and include the
populate
query param, only thecontracts
gets populated even though I indicate that I wantactive_contract
too.active_contract
always returns asnull
.When using the new Document Service API directly in the controller with the same params,
active_contract
gets populated andcontracts
is[]
The only thing that worked is to write a custom controller for the
find
andfindOne
methods to return the results with the Entity Query API. So it seems that in v5, I cannot rely on the REST API directly. This definitely feels like a bugSteps to reproduce the behavior
property
contract
property
calledcontracts
(belongs to many) andactive_contract
(has one)Expected behavior
I want both my relations populated when I make a REST API call or use the new Document Service API
Screenshots
Code snippets
❌ REST API Example on the client that doesn't populate
active_contract
:❌ Document Service API where this time
contracts
returns an empty array andactive_contract
is populated:✅ And the Query Engine API that works:
The text was updated successfully, but these errors were encountered: