Try to search your question here, if you can't find : Ask Any Question Now ?

How to iterate the list of students that belong to this classroom?

HomeCategory: stackoverflowHow to iterate the list of students that belong to this classroom?
sourav asked 2 weeks ago

How do I list only the students that belong to the classroom?

**Student MongoDB**
id: ObjectId('5cafc39681d41e11ecccd042')
classroom:
  Objectid:('5cafb1d9a36c8123f86b8e30')
fullName:"Student Jim"
__v:0

**Classroom MongoDB**
_id: ObjectId:('5cafb1d9a36c8123f86b8e30')
author: Objectid:('5ca405020a1fef3ed0a3dcb8')
createdAt:2019-04-11T21:30:01.004+00:00
classroomname:"Classroom 2"
__v:0

Now, I have tried to iterate, so I can list only the students that belong to the classroom I have clicked on, which opens in http://localhost:8080/classroom/students/5cafb1d9a36c8123f86b8e30 , which is the classroom ID.

Here is how I tried to iterate:

    extends layout

block content
    for classroom in classrooms && student in students
        if student.classroom.id == classroom.id
            p= student.fullName

I am not sure if I am on the right track, if I am I only miss the iteration part.
Thank you for helping out.

1 Answers
Best Answer
Mikhail answered 2 weeks ago
Your Answer

0 + 6 =

Popular Tags

WP Facebook Auto Publish Powered By : XYZScripts.com