Two behaviors of value template. #410
ATaiIsHere
started this conversation in
General
Replies: 1 comment
-
You need to provide the userId that is required by the value template for GSI1PK. Also, if you put isRead in the value template, then the GSI entry would only get created when the value is true and you would not need to provide the GSI values to the model.find. Best practice is to use value templates to create the PK/SK, GSI PK/SK values for you. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I have a
MESSAGE
model to store messages for users.I hope
GSI1PK
,GSI1SK
are created whenisRead
is false, so I write my schema like this.When use
gsi-1
to find message ( likemodel.find({ GSI1PK: 'USER#1', GSI1SK: 'UNREAD' }, { index: 'gsi-1' })
) ,I got a
MissingError
asEmpty hash key. Check hash key and any value template variable references
,why is there such a difference?
this makes me need to think more about I can use GSI1PK, GSI1SK to query directly or not.
Beta Was this translation helpful? Give feedback.
All reactions