Results 1 to 3 of 3

Thread: Persisting Objects from a List to seperate MongoDB Collection

  1. #1
    Join Date
    Jan 2009
    Posts
    18

    Default 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. #2
    Join Date
    Apr 2006
    Location
    Dresden, Germany
    Posts
    483

    Default

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

  3. #3
    Join Date
    Jan 2009
    Posts
    18

    Default

    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

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •