List all with id as unique partition key? #210
Unanswered
brandonpsmith
asked this question in
Q&A
Replies: 1 comment 5 replies
-
Hi @brandonpsmith 👋 With ElectroDB, you only have to interact with the individual PK and SK composite attributes themselves -- how you provide these to ElectroDB means different things: // Access queries on the `query` object
await LocationEntity.query
// The "Access Pattern Method"
// Must at a minimum include the attributes that make up the PK, but also accepts sort key attributes
// If you provide a sort key attribute, ElectroDB will treat this value as being complete (e.g. The "complete" for the location "Texas", not "Tex")
// Lastly, you still must provide your sort keys in the order they are defined in your "composite". ElectroDB is building a string after all, and it can't
// build a key out of left-to-right order.
.primary({ location: 'Georgia', latitude: '33.753746' })
// The "Sort Key Condition Methods" allow for partial sort keys or unique conditions on sort keys (e.g. 'between', 'begins', 'gte', 'gt', 'lte', 'lt')
.begins({ Longitude: '-8' })
// complete the query
.go() Let me know if this helps, you can find more detail on this here: https://electrodb.dev/en/queries/query/ |
Beta Was this translation helpful? Give feedback.
5 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I'm trying to query all
locations
. How do I query begins withLOCATION#
and get alllocations
? ...Beta Was this translation helpful? Give feedback.
All reactions