Contentful logo

Contentful Community

JavaScript SDK Sort order

client.getEntries({
content_type: ‘someType’,
order: ‘-fields.name’,
})

This works but how do I change ascending or descending.

Thanks!!!

Hi @eastcoastgranite.it,

You’d change that according to the minus sign attached to your query:

https://www.contentful.com/developers/docs/references/content-delivery-api/#/reference/search-parameters/reverse-order/query-entries/console/js

https://www.contentful.com/developers/docs/references/content-delivery-api/#/reference/search-parameters/order/query-entries/console/js

That worked. Thanks so much!!