[ad_1]
There are some answers in some forums about this question where people are generally repeating the already confusing AWS documentation about DynamoDB, but I need an example to see how it actually works.
I have this query :
SELECT id, message, created, FROM "messages"."sender_company_id-index"
WHERE sender_company_id = 435634652 AND receiver_company_id = 69992528
AND sender_user_id = 186 AND receiver_user_id = 201
ORDER BY id DESC
and it fails with this error message:
An error occurred during the execution of the command.
ValidationException: Variable reference id in ORDER BY clause must be
part of the primary key
created field is already indexed so what’s wrong? Why does it require it to be “part of the primary key”? I would like to order by different fields in different cases so I cant have all of them set as primary key. I dont get it!
[ad_2]