Skip to content

How to list more than 1000 objects from a collection

<#function list_all_objects pattern collection_name index>
    <#assign list = list_objects(pattern, collection_name, index*1000, 1000)>
    <#if (list?size = 1000)>
        <#assign list = list?eval + list_all_objects(pattern, collection_name, index + 1)>
        <#return list>
    <#else>
        <#return list?eval>
    </#if>
</#function>

<#assign my_pattern = {}>
<#assign my_collection_name = "clients">
${list_all_objects(my_pattern, my_collection_name, 0)}