# Forest new agent, ordering collection

**URL:** <https://community.forestadmin.com/t/forest-new-agent-ordering-collection/7774>\
**Category:** Help me!\
**Tags:** howtos\
**Created:** [January 23, 2025, 11:38am UTC](https://community.forestadmin.com/t/forest-new-agent-ordering-collection/7774 "2025-01-23T11:38:43Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Adel\_de\_Clevermate](https://dub1.discourse-cdn.com/flex013/user_avatar/community.forestadmin.com/adel_de_clevermate/32/4608_2.png) [@Adel\_de\_Clevermate](https://community.forestadmin.com/u/Adel_de_Clevermate)\
**Post date:** [January 23, 2025, 11:38am UTC](https://community.forestadmin.com/t/forest-new-agent-ordering-collection/7774/1 "2025-01-23T11:38:43Z")

</div>

## Feature(s) impacted

listing records of collection

## Observed behavior

the items are ordered by default by id (key) ascending

 ![image](https://europe1.discourse-cdn.com/flex013/uploads/forest/original/2X/a/a19b3ac91ac539b55164be33970807fd35f67d64.png)

## Expected behavior

the collection is a view in database and it has a specific order defined  
 ![image](https://europe1.discourse-cdn.com/flex013/uploads/forest/original/2X/d/d0e2859843b1e78c0b594a28d0af8d9ac50b1b84.png)  
however this order seems to be overrided by the default order by id

no sorting field is defined in the config:

 ![image](https://europe1.discourse-cdn.com/flex013/uploads/forest/original/2X/b/b9af87a9db4bc7ae6f7a975191f9cc0aca05e732.png)

## Context

in the old agent version it was listing following the order of the view as in database.

- Project name: clevermate v2
- Environment name: dev
- Agent technology: (nodejs,
- Database type: postgres

---

<div class="post-metadata">

**Author:** ![shohanr](https://dub1.discourse-cdn.com/flex013/user_avatar/community.forestadmin.com/shohanr/32/4999_2.png) [@shohanr](https://community.forestadmin.com/u/shohanr)\
**Post date:** [January 23, 2025, 1:21pm UTC](https://community.forestadmin.com/t/forest-new-agent-ordering-collection/7774/2 "2025-01-23T13:21:55Z")

</div>

Hi @Adel_de_Clevermate

Is Hunter Game a smart collection ?

Regards,

Shohan

---

<div class="post-metadata">

**Author:** ![Adel\_de\_Clevermate](https://dub1.discourse-cdn.com/flex013/user_avatar/community.forestadmin.com/adel_de_clevermate/32/4608_2.png) [@Adel\_de\_Clevermate](https://community.forestadmin.com/u/Adel_de_Clevermate)\
**Post date:** [January 23, 2025, 2:03pm UTC](https://community.forestadmin.com/t/forest-new-agent-ordering-collection/7774/4 "2025-01-23T14:03:11Z")

</div>

Hi @shohanr ,  
No, it’s a normal collection, a view in DB.

---

<div class="post-metadata">

**Author:** ![anon7311026](https://avatars.discourse-cdn.com/v4/letter/a/f9ae1b/32.png) [@anon7311026](https://community.forestadmin.com/u/anon7311026)\
**Post date:** [January 24, 2025, 2:51pm UTC](https://community.forestadmin.com/t/forest-new-agent-ordering-collection/7774/5 "2025-01-24T14:51:23Z")

</div>

Hello @Adel_de_Clevermate,

Looking through the sorting implementation on the `agent` package, we realised that it was not letting the database apply default sorting and forcing a sort on primary keys when no sort was requested from the frontend.  
This has been fixed in the [latest agent version](https://github.com/ForestAdmin/agent-nodejs/releases/tag/%40forestadmin%2Fagent%401.58.2). Please upgrade and let us know if this is the expected behaviour for you.  
Please note that you will still have to unset any sort order in your collection layout 🙏

@anon7311026
