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 Answers
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
EXPERT
answered a year ago
0
  • Please describe instead of attaching link

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions