I want to do DynamoDB query items with multiple filters something like: latest post(createdAt), country (According to user country), ByuserId, with specific tag Is this possible?

0

My items in DynamoDB table is according to this model:

type Post @model{
I'd: ID
content: string
Country: string
Tag: [string]
ByuserId:ID!
Createdat:AWSdate
}

I want mutiple filter like specifictag, specific time, by specific user,post with specific country.

Like YouTube feed most posts are: chennal you subscribed, tags that are related to watch history, posts are mainly from current user country , and they promote latest post

2 回答
1

You can specify multiple filters using a FilterExpression, however it is highly in-efficient and best to be avoided:

FilterExpression="specifictag=123 AND specifictime=92487109247"

To make things more efficient you can make use of overloading your keys, or using composite keys. For example, if you always want to filter based on the same attributes in order, then you can define your schema to suit that. This makes our query calls highly efficient, but can take some thought to get the schema design correct

pkskdata
user123dynamodb#2022-10-21#IrelandData
KeyConditionExpression="pk=user123 AND sk=dynamodb#2022-10-21#Ireland"
profile pictureAWS
专家
已回答 1 年前
0
  • Please describe instead of attaching link

您未登录。 登录 发布回答。

一个好的回答可以清楚地解答问题和提供建设性反馈,并能促进提问者的职业发展。

回答问题的准则