Closed sayou closed 1 year ago
You need to use a different referencing strategy: https://www.doctrine-project.org/projects/doctrine-mongodb-odm/en/2.3/reference/reference-mapping.html#storing-references
Exactly what @Steveb-p wrote :) The only thing I'd like to add that not supporting DBRef objects is not a shortcoming of ODM, but MongoDB itself.
Support Question
I am currently working on programming a website using Symfony version 6.2 and API Platform in addition to MongoDB (version v6.0.3) in the database.
I try to use the Subresources and I followed the official documentation of the API Platform: https://api-platform.com/docs/core/subresources/
I tried to use exactly what is written on the documentation (this is the code):
and for the Company class:
but while using the Postman to get the result from
/companies/{companyId}/employees
, this error message appears:"Cannot use reference 'company' in class 'App\\Document\\Company' for lookup or graphLookup: dbRef references are not supported."
Is there any solution to that?