Open yamatatsu opened 1 year ago
Generally, we try to design our keys and indexes so that a single query can fetch a collection. Is this what you mean or do you mean OneTable providing an API that will do multiple low level DynamoDB operations?
Can you give an example:
Hi mobsense.
I mean to get multiple entities not items.
Example:
await table.find(["User", "Order"], { userId: "user_anyuuid1" });
// return: {
// user: [
// {
// pk: "user_anyuuid1",
// sk: "user_anyuuid1",
// userId: "user_anyuuid1",
// }
// ],
// order: [
// {
// pk: "user_anyuuid1",
// sk: "order_anyuuid1",
// orderId: "order_anyuuid1",
// orderedBy: "user_anyuuid1",
// },
// {
// pk: "user_anyuuid1",
// sk: "order_anyuuid2",
// orderId: "order_anyuuid2",
// orderedBy: "user_anyuuid1",
// },
// ]
// }
ElectroDB can query like as this with typescript typing. https://electrodb.dev/en/modeling/collections/
I believe it is very helpful for users using TS.
Thank you.
This would be a great addition to the library.
Across entities query is the essence of single-table design. https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/bp-relational-modeling.html
As electrodb, if also onetable gets support of across entities query, it will be super extra value of this product I think. https://electrodb.dev/en/core-concepts/single-table-relationships/