key should be case sensitive
Closed this issue · 1 comments
LaurenceHo commented
Describe the bug
When I use "get" method to get an object e.g
const response: QueryResponse<typeof this._entity> = await this._entity
.get({id: "Apple-and-Orange"})
.go();
I cannot get this object, which exists in DynamoDB. So I placed the logger into entity, and I found out the "id" became lower case. Here is part of log:
queryKey { id: "Apple-and-Orange" }
{
"type": "query",
"method": "get",
"params": {
"Key": {
"id": "apple-and-orange"
},
"TableName": "my-table"
},
"config": {
"includeKeys": false,
......
ElectroDB Version
2.13.1
ElectroDB Playground Link
N/A
Entity/Service Definitions
Include your entity model (or a model that sufficiently recreates your issue) to help troubleshoot.
{
model: {
entity: "my_entity",
service: "my_service",
version: "my_version"
},
attributes: {
prop1: {
type: "string"
},
prop2: {
type: "string"
}
},
indexes: {
record: {
pk: {
field: "pk",
composite: ["prop1"],
},
sk: {
field: "sk",
composite: ["prop2"],
},
}
}
}
Expected behavior
Key should be case-sensitive rather than converted to lower case.
Errors
Cannot find the object from Electrodb but it exists in DynamoDB.
Additional context
Add any other context about the problem here.
LaurenceHo commented
For anyone who is running into the same issue as me, we can add casing
in the index. Please check this doc.