I have a collection containing documents of employees. Each employee have an array of documents with the projects this employee is currently involved in. The problem is that i don't know how to get/query the array of projects?
Here is an example of such document.
{name : "employe name" , age : "..employe age" , phoneNr : 12334 , projects :
[{ projectName : "project name" , projectLeder : "project leader" }] }
Here is an example code for retrieving the values in the document except the project array.
public void printEmployees() {
MongoCursor<Document> cursor = coll.find().iterator();
while(cursor.hasNext()) {
Document documentEmployee = cursor.next();
System.out.println((String) documentEmployee.get("name"));
System.out.println((Integer) documentEmployee.get("age"));
System.out.println((Integer) documentEmployee.get("phoneNr"));
//How do i query/extract the project array?
}
}