Identifier conversion not considered during `@DocumentReference` construction
See original GitHub issueHi,
I use the new feature of document reference annotation @DocumentReference and have a issue about it. In case I have Country and City documents and City referenced to Country with this annotation. But “_Id” field of type on Country document is ObjectId. I write this code on City document as well:
@DocumentReference
private Country country;
When I get Country of City object it couldn’t fetch data and return null. Because of Country document reference stored as String type. I think there is a type mismatch on lookup query.
I think we need like 2 options on document reference.
- dataType parameter on DocumentReference annotation class. (example : ObjectId, String …)
- Or custom lookup field.
@DocumentReference(lookup = "{ '_id' : new ObjectId('?#{#target}') }")
private Country country;
or
@DocumentReference(lookup = "{ '_id' : { $oid: '?#{#target}' } }")
private Country country;
- Spring should get the data type of referenced document and according to prepare lookup query
Issue Analytics
- State:
- Created 2 years ago
- Reactions:1
- Comments:8 (3 by maintainers)
Top Results From Across the Web
android - How to convert Firebase Document Reference to ...
Now to implement the same in my app, I would like to know how to convert the Firebase Document Reference to Firebase Query...
Read more >DocumentReference - FHIR v5.0.0-cibuild
A reference to a document of any kind for any purpose. ... The DocumentReference resource provides metadata about the document so that the...
Read more >Class DocumentReference (2.7.3) | Python client library
A reference to a document in a Firestore database. The document may already exist or can be created by this class. Parameters. Name,...
Read more >DocumentReference - FHIR v4.0.1
PDF documents , Scanned Paper, and digital records of faxes; Clinical Notes in various forms; Image files (e.g., JPEG, GIF, TIFF); Non-Standard formats...
Read more >RFC 3986: Uniform Resource Identifier (URI): Generic Syntax
This specification does not define a generative grammar for URIs; ... transcribe a resource identifier from one medium to another has been considered...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Than you for your quick response
Ok. Thank you.