Suppose I have the following documents in mongodb in an employee collection:
db.employees.insert({_id: ObjectId("4d85c7039ab0fd70a117d733"), name: 'Siona',
manager: [ObjectId("4d85c7039ab0fd70a117d730"), ObjectId("4d85c7039ab0fd70a117d732")] })
Here, "Siona" has two managers listed in the managers array. I know that Spring Data M3 has the concept of DBRefs, but the monogdb documentation indicates that DBrefs are expensive, and that we should just store the ObjectId whenever possible.
My question is, is there any way to resolve the document pointed to by the objectID object via the Spring Data Document api, or am I forced to make a client-side connection, where:
- We get a document that has a name: "Siona"
- Return to the database to enable each ObjectId that represents the Siona managers.
source
share