Populate only if condition is met

According to your definition in UserInterface, a user can be enrolled in multiple courses. So I will do:

  1. Unwind courses field of User
  2. filter out courseEnrollments.confirmed == false
    Then I think it’s the result you want.