so i used pug loops to show 2 docs of my collection but when it's going to show them, it shows them twice. here is the code:
each request in requests
-if(request.course.master.id===user.id)
each reqUser in request.course.users
tr
td=request.course.name
td=reqUser.name
td=reqUser.email
this is a request doc of my requests collection ===>
_id:61c879ab1fd17239e85a8b7a
duration:Array
price:Array
createdAt:2021-12-26T14:16:55.302+00:00
expiresAt:
2022-01-25T14:16:55.302+00:00
accepted:true
course:ObjectId("61b60458acbb1fa4598eea36")
user:ObjectId("61c879941fd17239e85a8b68")
id:"63341"
i have access to the course of this request and i want the user of this course.
also this is the course doc of my courses collection ===>
_id:ObjectId("61b3708276844971620c98ea")
images:Array
users:Array
name:"assembly "
imageCover:"course-assembly"
duration:Array
master:ObjectId("61c2bfc0ac2f110af04903a2")
in the pug code up there , first i want to check if the current logged in user is the master of the given course or not; then if it's true i want to make a row for each user of the course but it gives 2 completely same rows for each user in this shape ===>