Closed mohsinsiyal-tsi closed 2 years ago
@mohsinsiyal-tsi
I think we cannot sort the results of scan
before fetching all data. ScanIndexForward
is a feature for query
.
In addition, DynamoDB cannot sort items across multiple partitions. We need to put items in the same partition to sort them.
It seems you can use your gsi_0
to sort items for specific customer_id
. For example:
$res = AuditLog::index('gsi_0')
->keyCondition('customer_id', '=', 1)
->scanIndexForward(false)
->query();
Yes you are right.. What was I thinking. Sorting can only be done with query and not scan.
Hi, I am trying to sort the data with sort key but it's not working. Schema:
Model:
Controller: