Hi,
I am about to use Custom Entity Storage for our app’s use case.
Now I stumbled upon an unknown behavior that still leaves me unclear.
So basically the query results are empty although I should have added entities to the storage.
This is hard to debug, because the custom entity storage is not visible in the app console and I cannot experiment a lot with the entities because the amount I can try is very limited.
I define the entity by manifest like this:
app:
storage:
entities:
- name: entity-test
attributes:
timestamp:
type: integer
parentUid:
type: string
projectId:
type: string
indexes:
- name: by-timestamp-inc-and-project
range:
- timestamp
partition:
- parentUid
- projectId
And I add multiple entities like this (simplified):
const key = data.parentUid + ":" + data.projectId + ":" + data.timestamp;
await storage.entity("entity-test").set(key, data);
Which doesn’t fail.
And I Query the entities like this:
const { results } = storage
.entity("entity-test")
.query()
.index("by-timestamp-inc-and-project", {
partition: [parentUid, projectId],
})
.sort(SortOrder.ASC)
.getMany();
The query doesn’t fail. The results
are empty. But I expect, there should be my entries for the parentUid
, projectId
combination ordered by timestamp
.