Case-insensitive sort?

When sorting on a text field, capital letters are given a priority over lowercase, meaning AB sorts before Aa. Is there a way to make the sort case insensitive?

Hello @innes,

Would you be able to share your query/code? I would be able to provide a better solution based on your implementation.

Sure thing…

    const data = await builder.getAll('logo', {
        limit: 10,
        options: {
            sort: {
                data: { company: 1 }
            noTargeting: true,

For the text field company, values starting with AB will sort before values starting with Aa. Same results in the API explorer.

Getting AB, Aa, Ac …

Hello @innes,

The current version of the Content API does not yet provide built-in functionality for specifying case sensitivity within the query. However, you can achieve case insensitivity by parsing the results as demonstrated in the example below.

data = data.results.sort(function(a, b){ 
  const companyA =; // ignore upper and lowercase
  const companyB =; // ignore upper and lowercase

  if(companyA < companyB) { 
    return -1;
  if(companyA> companyB){
    return 1;
  return 0;


If a post-query approach is not feasible for your use case, please let me know, and I’ll be more than happy to assist you in finding a suitable workaround or explore other options.

Thanks, the maximum results I’m getting out is 100, as we recommend Builder as a solution, I can definitely see needing to sort more than 100 items alphabetically in a case-insensitive sort. What are the options for doing this that don’t involve paging through an entire content model and sorting locally?

Hello @innes

If I understand correctly, you’re wanting to avoid receiving multiple arrays from each call that only returns 100 results each?
I was able to locate the following forum post that I believe answers your question. The post also provides a solution that returns a single array with all the results.

Please let me know if I’m misunderstanding or if I may be able to help get closer to a more satisfactory solution.

I get that we can make an array from multiple calls, I’m wondering if that can be avoided, it’s inefficient to do that just to perform a basic sort.

Case-insensitive sort should be the default, I think that’s the most common use case.