You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There's currently no support for manually loaded lazy references.
@DBRef is a bit of a mess right now for a few reasons:
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.
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.
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
The text was updated successfully, but these errors were encountered:
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.
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: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.
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.
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 DBAffects: 1.4.2 (Codd SR2)
3 votes, 3 watchers
The text was updated successfully, but these errors were encountered: