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
전문가
답변함 일 년 전
0
  • Please describe instead of attaching link

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인