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 Risposte
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
ESPERTO
con risposta un anno fa
0
Evan
con risposta un anno fa
  • Please describe instead of attaching link

Accesso non effettuato. Accedi per postare una risposta.

Una buona risposta soddisfa chiaramente la domanda, fornisce un feedback costruttivo e incoraggia la crescita professionale del richiedente.

Linee guida per rispondere alle domande