umbraco-community/umbraco-graphql

Need a way to get multiple objects by id (basically we need a byIds method)

Closed this issue · 1 comments

Trying to get multiple Hotels in my example. I can't seem to do it without having to use an alias for each on. Ideally I just want to pass in an array of ids and have an array of Hotels returned:

// With alias' but this returns an object with named fields 
// (hotel1 etc.) which you can't iterate over easily
{
  content {
    byType {
      hotel1: HotelPage(id: 2092) {
        pageTitle
      }
      hotel2: HotelPage(id: 2091) {
        pageTitle
      }
      hotel3: HotelPage(id: 2087) {
        pageTitle
      }
    }    
  }
}
// This is more what I want it to do
{
  content {
    byIds (ids: [123,234,355]) {
      ... on HotelPage {
		pageTitle
      }
    }    
  }
}

Hi

Just wanted to let you know that the project is moving to the Umbraco Community GitHub organisation, so we are closing all existing issues.

If you think your issue is still relevant, please feel free to reopen it.

/Rasmus