-
Notifications
You must be signed in to change notification settings - Fork 1.1k
@DocumentReference
does not work as a drop-in replacement of @DBRef
#3792
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
From reading the description I cannot spot what exactly the issue might be, given that the tests, in |
I crafted this example just now with Spring Initializr. test-mongo-documentreference.zip Attached belo MongoDb datatabase view on Intellij IDEA.
|
@DocumentReference
does not work as a drop-in replacement of @DBRef
Thanks for the sample. There's been an update on constructor argument handling in the recent |
You are welcome and glad this helps. |
I think we can close this one because #3842 has been resolved meanwhile. If you're still having trouble please feel free to drop a note and reopen the issue. |
Thanks @christophstrobl , although I don't understand how the change set in #3842 fixed this issue but I will take some time to upgrade and revert if it doesn't fix the issue. |
Hi there,
I came across the new feature
@DocumentReference
as I was working on something that needs support of another new featureTimeSeries
.I was trying to use
@DocumentReference
on a new field as I want to store["612cf1ef637b391363f1392e"]
instead of the DbRef equivalent["{ \"$ref\" : \"COLLECTION_NAME\", \"$id\" : \"612cf1ef637b391363f1392e\" }"]
Following the documentation here: https://docs.spring.io/spring-data/mongodb/docs/3.3.0-M2/reference/html/#mapping-usage.document-references
I thought I could use (Kotlin)
as a drop-in replacement of
But unfortunately it doesn't work as I expected.
I tried both
MongoRepository
andMongoTemplate
and both complain about missing a converter from aString
toMyListItem
.With the help of a debugger, I think it should be related to this block of code.
https://github.com/spring-projects/spring-data-mongodb/blob/3.3.0-M2/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/convert/MappingMongoConverter.java#L2068
I was expecting there is a block of code similar to the
DbRef
that help resolvingDocumentReference
.The text was updated successfully, but these errors were encountered: