Open
Description
Bug description
My site is using the eloquent driver for asset handling. I have nested files/folders which I am trying to sort by "Size". When doing so, I get incorrect results. Here's a screenshot of what I'm seeing:

The query that I'm seeing from my instance of the debug bar looks like this:
select * from `assets_meta` where `container` = 'assets' and `folder` = 'partners' order by json_unquote(json_extract(`meta`, '$."size"')) asc limit 5 offset 0;
I have tried this on 2 other sites all using Statamic 5 with the latest version of the eloquent-driver, and all of them are getting the same kinds of results.
I also tried switching back to the file system, and when I did that, the sorting by size worked perfectly fine.
How to reproduce
Ensure that your eloquent-driver.php
config file has the asset_container
and assets
drivers set to eloquent
.
Logs
No response
Environment
Environment
Application Name: *********
Laravel Version: 11.44.2
PHP Version: 8.2.27
Composer Version: 2.8.4
Environment: local
Debug Mode: ENABLED
URL: *********.test
Maintenance Mode: OFF
Timezone: America/Edmonton
Locale: en
Cache
Config: NOT CACHED
Events: NOT CACHED
Routes: NOT CACHED
Views: CACHED
Drivers
Broadcasting: log
Cache: redis
Database: mysql
Logs: stack / single, slack
Mail: mailgun
Queue: redis
Session: redis
Livewire
Livewire: v3.6.2
Laravel-Modules
Version: v11.1.10
Sentry
Enabled: MISSING DSN
Environment: local
Laravel SDK Version: 4.13.0
PHP SDK Version: 4.10.0
Release: NOT SET
Sample Rate Errors: 100%
Sample Rate Performance Monitoring: NOT SET
Sample Rate Profiling: NOT SET
Send Default PII: DISABLED
Statamic
Addons: 7
Sites: 5 (*********, *********, *********, *********, *********)
Stache Watcher: Disabled
Static Caching: Disabled
Version: 5.51.0 PRO
Statamic Addons
alt-design/alt-redirect: 1.6.3
jacksleight/statamic-bard-mutator: 3.0.3
jacksleight/statamic-bard-texstyle: 3.4.1
mitydigital/sitemapamic: 3.2.0
statamic/eloquent-driver: 4.21.0
stillat/antlers-components: 2.5.0
teamnovu/statamic-unused-assets: 2.0.2
Statamic Eloquent Driver
Asset Containers: eloquent
Assets: eloquent
Blueprints: file
Collection Trees: eloquent
Collections: eloquent
Entries: eloquent
Forms: eloquent
Global Sets: eloquent
Global Variables: eloquent
Navigation Trees: eloquent
Navigations: eloquent
Revisions: eloquent
Sites: file
Taxonomies: eloquent
Terms: eloquent
Tokens: file
Additional details
No response