Hi all,
I m looking for a full example of how to use Pocodynamo + the QueryAsync method to query a table’s local secondary indexes.
Thanks
Yannis
Hi all,
I m looking for a full example of how to use Pocodynamo + the QueryAsync method to query a table’s local secondary indexes.
Thanks
Yannis
Docs + example on PocoDynamo’s docs repo:
I guess my question is around this example.
If Cost is the Local Secondary Index below then how would I query for the partition key and the local secondary index?
var expensiveOrders = q
.LocalIndex(x => x.Cost > 10)
.Exec();
What have you tried? Does the normal key condition query not work?
The table partition key is UserId and the sort key is Id
The local secondary index is on LatestSortKey. Here is what I have tried:
_db .FromQuery<BlobUpload>() .LocalIndex(x => x.UserId == request.UserId && Dynamo.BeginsWith(x.LatestSortKey, request.WhereCategory)) .ExecAsync<BlobUpload>(100, token);
The error for the above is
Could not find index for field ‘UserId’
When I try it in that format:
_db
.FromQuery<BlobUpload>(x => x.UserId == request.UserId)
.LocalIndex(x => Dynamo.BeginsWith(x.LatestSortKey, request.WhereCategory))
.ExecAsync<BlobUpload>(100, token);
I get:
Only 1 Index can be queried per QueryRequest
The standard GetItemAsync (i.e. for the main PK + SK) works fine
Any ideas?
Actually - ignore me for a bit please. I havent set everything up correctly as it seems. Thanks