I am learning Spring with mongo db and i'm feeling difficulty in learning entity relationship model. Can anyone teach me how can i implement the following design.
Person collection A person class
List of sports object
Sport collection A Sport class
id (Auto generated)
while i am saving the person class which contains sport class, Sport entity should be saved in Sport collection if it is not already present and Person entityShould be stored in Person collection with Sport objects Reference.
While i am retrieving Person class, associated sport class should be fetched from corresponding collection. I have tried with @DBRef and it is not worked for me. It will be very helpful if anyone teach me this scenario or giving the reference to learning this concepts.