Announcement Announcement Module
Collapse
No announcement yet.
Persisting Objects from a List to seperate MongoDB Collection Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Persisting Objects from a List to seperate MongoDB Collection

    Hello,

    I have a class with a List:

    Code:
    public class A {
        private List<Message> messages = Lists.newArrayList();
    }
    The class A can be saved. For this I use a simple interface that extends the PagingAndSortingRepository and is
    Spring generated.

    Now, the messages List is saved as an Array in MongoDB. But I would like that each Message instance is just
    saved in a MongoDB Collection called "message". The Message Class is properly annotated.

    Is this possible?

    Greetings

  • #2
    Too lazy to read the reference docs? http://static.springsource.org/sprin...age-references

    Comment


    • #3
      Hello Oliver,

      thank you. No actually I read all of it, but I had only the cascade save in my mind...
      In the moment I do not need the DBRefs to be saved in Document A. Is there a way to achieve
      it without the need to manage this with a separate "Messages Repository"?

      Greetings

      Comment

      Working...
      X