Sort by combination of fields in Javascript API

hi there

i'm querying the api via:

i'm querying the javascript api via:

const queryData = await this.$prismic.api.query(
      this.$prismic.predicates.any('document.type', ['news', 'press'])
      orderings: '[ desc, desc]',
      pageSize: 100, // max pageSize
      page: pageNumber

press-items and news-items both have a "date" field on them.

the ordering currently orders all results by and THEN by which leads to all the press-results being returned first.

How can I sort all of the results by date? So that the results are a list of news and press-items both sorted by date? Something like ""?

1 Like

Hi @rrkuepper, unfortunately it isn’t possible to order your results by a Date field across different custom types. This is something I would love to see myself, and I’ve added another tick for this in our feature request tracker as a possible improvement for the future.

For now, you’ll need to organize the results in your website app after querying.

This is being tracked as an open feature request.

If you have another use-case for this feature, you can 'Flag' this topic to reopen. Please use the :heart: button to show your support for the feature and check out our Feature Request Guidelines.