'How to get all data of array of ids in one query in graphql?

My query for Roster -

query GetRoster(
  $startDate: DateTime!
  $endDate: DateTime!
  $wardId: String!
  $rosterTypeId: String!
) {
  roster: getRoster(
    roster: {
      startDate: $startDate
      endDate: $endDate
      wardId: $wardId
      rosterTypeId: $rosterTypeId
    }
  ) {
    _id
    duties {
      _id
      allocation {
        _id
        email
        fullName
      }
      isCancelled
    }
    cancelledDuties {
      _id
      allocation {
        _id
        fullName
        email
      }
    }
    shiftTemplate {
      _id
      name
      startTime {
        hour
        minute
      }
      duration {
        hour
        minute
      }
      requirements {
        minimumStrength
        requiredProcedures {
          procedure {
            _id
            name
          }
        }
        requiredRoles {
          hospitalRoleType {
            _id
            hospitalRoleType {
              title
            }
          }
          minimumAssignments
        }
      }
    }
  }
}

This takes single wardId and returns roster of only that wardId. But I have an array of wards which contains wardIds but I don't want to query getRoster for each wardIds instead is there any method to get rosters for all wards of wards array by wardId in one query ?

Thankyou!



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source