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 réponses
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
répondu il y a un an
0
  • Please describe instead of attaching link

Vous n'êtes pas connecté. Se connecter pour publier une réponse.

Une bonne réponse répond clairement à la question, contient des commentaires constructifs et encourage le développement professionnel de la personne qui pose la question.

Instructions pour répondre aux questions