1

I have the following models:

public class Document {
  @Id
  private Stirng id;

  private HashMap<Language, LanguageDocument> languageDocuments;
}
public class LanguageDocument {
  private String title;
}

The Document class is a MongoDB collection that I can access via a MongoDB repository. I want to search for Documents by the titles (saved in the nested HashMap languageDocuments). The following query method doesn't work for HashMap (return 0 objects) but it would work if languageDocuments would be a List<LanguageDocument> (analog to Spring data, find by property of a nested object).

public interface DocumentRepository extends ReactiveMongoRepository<Document, String> {
  Flux<Article> findByLanguageArticles_Title(String title);
}

How would I search for Document objects by an attribute in a nested HashMap object?

Felix
  • 117
  • 3
  • 11

0 Answers0