Comments (2)
Thank you for reaching out!
@DocumentReference
is no drop in replacement for @DBRef
, but an alternative approach of storing references between documents. I'm not aware of any section in the reference documentation that would promote the given scenario to work out of the box. If so, please let us know so we can update that part to be more clear.
from spring-data-mongodb.
Hello @christophstrobl!
Thank you for your answer!
Yes you are right: there is nothing directly about such replacement in the documentation.
Nevertheless it is not expected behavior that processing of such combination of annotations @DocumentReference
and @ReadOnlyProperty
on some field leads to loading of any data (in our case it is DBRef
but in general it could be anything) from MongoDB during evaluation of Spel expression. With spring-data our schema is specified in java code and java code should have higher priority than data in MongoDB. In our code this field is not DBRef
and should be ignored by default.
https://docs.spring.io/spring-data/mongodb/docs/current-SNAPSHOT/reference/html/#mapping-usage.document-references
It is also possible to model relational style One-To-Many references using a combination of @ReadonlyProperty and @DocumentReference. This approach allows link types without storing the linking values within the owning document but rather on the referencing document as shown in the example below.
So there is expectation after reading of documentation above that combination of @ReadonlyProperty
and @DocumentReference
tells Mapping Framework just ignore data in this field in MongoDB. If we don't store anything in the field, why it is necessary to read anything from it? How we can ignore existing data in MongoDB then?
from spring-data-mongodb.
Related Issues (20)
- Error Query JPA in INNER...INNER Id HOT 1
- MappingContext should not consider collection like types being an entity. HOT 1
- Cannot extend MongoRepository due to private properties / methods / classes HOT 5
- NPE when use MongoTemplate#updateFirst, MongoTemplate#updateMulti with Query#withHint HOT 2
- auto-index-creation will block app to start when one Mongo cluster node is offline HOT 6
- Reading entity with null value for primitive field fails since #4464 HOT 1
- Centering the documentation HOT 1
- Release 4.1.11 (2023.0.11)
- Release 4.2.5 (2023.1.5)
- Release 4.3 RC1 (2024.0.0)
- Upgrade to MongoDB 5.0 driver
- Aggregation `allowDiskUse` should not be `false` by default
- Incorrect Lock used in DefaultMessageListenerContainer HOT 1
- Redesign allowDiskUse attribute of Meta annotation.
- Nested JSON Handling Issue in Generic Class HOT 4
- AggregationResults include documents outside the MatchOperation when there is a MergeOperation present HOT 3
- Can't use properties in `@Indexed#expireAfter` HOT 1
- Align OffsetScrolling to zero-based indexes
- Criteria.regex is converted to String when applying to ID fields HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from spring-data-mongodb.