vguna
Sep 9th, 2011, 03:55 PM
Hi.
I'm using M4 together with mongodb 1.83. I've got an Object A that has:
@DBRef
List<B> bs = new ArrayList<B>();
Saving B, adding B to A and saving A writes the dbref to the mongodb.
But findOne on A and looking at the size of List<B> returns 1. Calling get(0) on that List returns null though.
A and B are separate Collections in mongodb. Looking at B in the db shows the correct attributes.
Any idea why that happens? I assume that DbRefs (more precise: related Objects) get eagerly loaded automatically when their parent is loaded. Is that correct?
Thanks in advance.
I'm using M4 together with mongodb 1.83. I've got an Object A that has:
@DBRef
List<B> bs = new ArrayList<B>();
Saving B, adding B to A and saving A writes the dbref to the mongodb.
But findOne on A and looking at the size of List<B> returns 1. Calling get(0) on that List returns null though.
A and B are separate Collections in mongodb. Looking at B in the db shows the correct attributes.
Any idea why that happens? I assume that DbRefs (more precise: related Objects) get eagerly loaded automatically when their parent is loaded. Is that correct?
Thanks in advance.