Skip to content

Support Spring Data @Reference annotation [DATAMONGO-915] #1839

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Closed
spring-projects-issues opened this issue Apr 17, 2014 · 3 comments
Closed
Assignees
Labels
in: mapping Mapping and conversion infrastructure type: enhancement A general enhancement

Comments

@spring-projects-issues
Copy link

David Rauschenbach opened DATAMONGO-915 and commented

There's currently no support for manually loaded lazy references.

@DBRef is a bit of a mess right now for a few reasons:

  1. Big systems don't use it, because it wastes storage space for no good reason. The exception being when db is not blank, for a cross-database reference.

  2. It triggers some drivers to eager-load, but that's not always what is always wanted. A developer might really rather manually deference a field to trigger the lazy load, especially if it is a big database or a realtime capped collection tailing use case. In my opinion the Mongo Spring Data driver really MUST provide a single-query option for loading a doc with reference fields.

  3. It requires Mongo-specific annotations, and doesn't inherit some of the reasonable Spring Data or JPA annotations that people will be using who are writing systems that have heterogeneous DB support, like @Reference or @Embedded hints.

The Spring Data @Reference annotation is an opportunity to deal with some of these things. It could become the means by which a simple ObjectId() is written into the DB


Affects: 1.4.2 (Codd SR2)

3 votes, 3 watchers

@spring-projects-issues
Copy link
Author

Tudor Matei commented

I would really like this feature as well. I have a pre-existing mongodb database that contains manual references.
http://docs.mongodb.org/manual/reference/database-references/#document-references

Any idea when this can be added?

@spring-projects-issues
Copy link
Author

Raviteja commented

I agree that DBRef is a mess, can't use it in aggregation pipeline because of mongodb doesn't support it. I have to rely on map-reduce instead of using simple aggregation pipeline to fetch the data.

FYI,

@spring-projects-issues spring-projects-issues added type: enhancement A general enhancement in: mapping Mapping and conversion infrastructure labels Dec 30, 2020
@christophstrobl
Copy link
Member

Resolved via: #3647

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
in: mapping Mapping and conversion infrastructure type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

3 participants