Let's say I've these 2 documents:
@Document
public class Exam {
private int examId;
private List<Question> questions;
and
public class Question {
private int questionId;
private String question;
I need to write a 'findAll' that returns a List of ALL Questions (or ideally only 'question' string in the Question object) for a certain 'Exam' object (examId == n) using MongoRepository or some other way in Java using Spring Data MongoDb, how do I do that?
{
"_id" : ObjectId("xyz"),
"_class" : "com.xxx.Exam",
"examId" : 1,
"questions" : [
{"questionId" : 1, "question" : "xyz" },
{"questionId" : 2, "question" : "abc" }
]
}