Whats the name of "count" and "find" queries when i use DBRef in conjunction with java.util.map?
In my example the countByFoos-Method always returns 0 instead of 1.
How can i find and count BarDaos by given FooDao?
public class FooDao {
@Id
private String id;
private String key;
...
}
public class BarDao {
@Id
private String id;
@DBRef
private Map<String, FooDao> foos;
...
}
public interface FooRepository extends MongoRepository<FooDao, String> {
...
}
public interface BarRepository extends MongoRepository<BarDao, String> {
long countByFoos(FooDao fooDao);
...
}
public void doSomthing() {
FooDao foo = new FooDao("fooId1", "key1");
fooRepository.save(foo);
BarDao bar = new BarDao("barId1");
bar.addFoo(foo.getKey(), foo);
barRepository.save(bar);
int count = barRepository.countByFoos(foo);
}