When calling save to an entity with reference. it would call a find before update.
If that's a reference in a list then it causes an N+1 issue.
example:
@Entity(value = "test1", useDiscriminator = false)
public class Test1 {
@Id
ObjectId _id;
String name;
List<EmbeddedTest2> embeddedTest2s;
...
}
@Entity(useDiscriminator = false)
public static class EmbeddedTest2{
Integer seq;
@Reference(idOnly = true, lazy = true, ignoreMissing = true)
Test2 test2;
...
}
@Entity(value = "test2", useDiscriminator = false)
public class Test2 {
@Id
ObjectId _id;
String name;
...
}
when calling datastore.save(test1). it will call 3 extra time of find "test2" if there are 3 entries.
would it be possible to group it in to 1 call with _id in [...] or just stop calling if ignoreMissing = true?
** Please complete the following information: **
Server Version: 8.0.20
Driver Version: 5.5.1
Morphia Version: 2.5.1
When calling save to an entity with reference. it would call a find before update.
If that's a reference in a list then it causes an N+1 issue.
example:
when calling datastore.save(test1). it will call 3 extra time of find "test2" if there are 3 entries.
would it be possible to group it in to 1 call with _id in [...] or just stop calling if ignoreMissing = true?
** Please complete the following information: **
Server Version: 8.0.20
Driver Version: 5.5.1
Morphia Version: 2.5.1