You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have worked with single table design, but it is the first time I am using ElectroDB. While I was setting up my project and creating entities, I have came across with a conceptual problem that I cannot figure out for myself. So let's look at this official example from the docs;
When we specifically check the author entity, from my understanding of the schema, a basic record of an author on the db will look like something like this for the composite key;
So saying that, there is no actual way to retrieve all of the authors in the database or application, as I need to provide the entire primary key while querying.
Let me give you another example, I am using AWS Cognito, and whenever a new user registered, I want to record this on my db with a post-confirmation trigger. For that, I will design a User entity schema. The primary index will look like this;
So as we are setting the unique id on the primary key, there is again no way to query all of the users in the system. If I was to not use any library but design the schema namings by myself, this would be the naming I would go with;
And with this, I would be able to retrieve all of the users with a begin_with operation on the SK.
Finally, you can see that I am a bit lost conceptually. I am sure that I am missing something here, so I will really appreciate if you can show me the correct way of doing this.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hello everyone,
I have worked with single table design, but it is the first time I am using ElectroDB. While I was setting up my project and creating entities, I have came across with a conceptual problem that I cannot figure out for myself. So let's look at this official example from the docs;
https://electrodb.dev/en/examples/library-system/
When we specifically check the
author
entity, from my understanding of the schema, a basic record of an author on the db will look like something like this for the composite key;So saying that, there is no actual way to retrieve all of the authors in the database or application, as I need to provide the entire primary key while querying.
Let me give you another example, I am using AWS Cognito, and whenever a new user registered, I want to record this on my db with a post-confirmation trigger. For that, I will design a User entity schema. The primary index will look like this;
While
user
is an attribute that is set by auuid()
as default.So a new record of a User entity will be something like;
So as we are setting the unique id on the primary key, there is again no way to query all of the users in the system. If I was to not use any library but design the schema namings by myself, this would be the naming I would go with;
And with this, I would be able to retrieve all of the users with a
begin_with
operation on the SK.Finally, you can see that I am a bit lost conceptually. I am sure that I am missing something here, so I will really appreciate if you can show me the correct way of doing this.
Thanks in advance!
Beta Was this translation helpful? Give feedback.
All reactions