Assume that I have such entities like the following:
@Document(collection = \"doc_a\")
public class A {
@Field(\"id\")
private Integer id;
@Field(
I had the same problem, for me the Miguel's solution worked but I had to wrap the @CompoundIndex inside a @CompoundIndexes otherwise it didn't work (I'm using Spring Roo).
@CompoundIndexes({
@CompoundIndex(name = "aid_bid_idx", def = "{'id' : 1, 'b.id' : 1}")
})
@Document(collection = "doc_a")
public class A {...}