How to query data from dynamoDB table with multiple filter layers?

0

I'm using AWS appsync API with lambda resolver. My question is how to add 2 separate filter when querying data from DynamoDB using direct lambda resolver?

My app is a news app. It has a feed. I want to show content in that feed like mixture of News of native country + News with 100K+ views. My problem is if I add and operator, condition will be like: native country news AND news with 100k+ views it will filter out only native country new with 100K+ views. But I want to show both native country news as well as global news with 100k+ views. Secondly if I use OR operator then if one condition become true it will fetch that type of content but I want in every 15 post there should be 10 native country news and 5 global news.

My question is I want that both conditions should be satisfied separately? if we use AND operator it will limit one condition.

1개 답변
0
수락된 답변

You are in a situation where you need to separate query, as your limit based on the condition so a single dynamodb query can have a single limit parameter

It s an application solution

Simply run two parallel tasks retrieving 2 query and mix them up

답변함 2년 전

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

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

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

관련 콘텐츠