I have a collection of lecturers (about 1000 documents) at mongodb.
I would like to extract from the collection following documents:
_id : lecturerId; Array<_id>: booksId;
I would like to extract the lecturers ID and the ID list (in the form of a List) of all books that are assigned to them
HOW MY DOCUMENTS LOOKS IN COLLECTION
Each lecturer has one lesson and each lesson has a list of books that have an id.
Lecturer object fields (document in collection)
String _id; String name; String surname; Timestamp date; Lesson lesson(OBJECT);
Lesson object fields: (inside Lecturer entity)
_id : LessonID; Array<Student>: students; Array<Book>: books;
Book object fields: (inside Lesson entity)
_id : BookID; String : name; String : author;
Thank you in advance for your help!