Register / Login
this forum made possible by our volunteer staff, including ...
Stephan van Hulst
Spring and MongoDB manual references
posted 1 month ago
I need advice on doing manual references in mongodb with spring without using dbrefs.
If for example, I have two document collections:
addresses: [addressId1, addressId2...]
So, user has 1 or more addresses. In user document, I want to use array of address ids.
Now, there is a question of inserting, updating and retrieving user document.
For insertion, I would need one POJO which has addresses as array of ids (array of ObjectIds, Strings..).
For retrieving, sometimes I need full document with addresses eagerly populated. For this case I would need different POJO which has addresses as array of address objects.
Is there any good approach to this? Any pieces of advice?
Yes, my master! Here is the tiny ad you asked for:
Java file APIs (DOC, XLS, PDF, and many more)
Boost this thread!
how to get record from MongoDB
Update MongoDb sub document which is in a array
MongoDB Initial Data Import
When to nest objects and when to use references
Accessing Files on a remote server