java - Index Based Querying and Sorting - DynamoDb - Stack Overflow

I am coming from an Android Application Development background. I am exploring DynamoDB and I've w

I am coming from an Android Application Development background. I am exploring DynamoDB and I've written a Kotlin server and linked it with DynamoDB. While I have successfully made connection, table, Partition Keys and Sort Keys, I'm having some trouble with Global Secondary Index.

I'm trying to build a pagination API, API needs support following params:

query by

title, release date, genres, min rating, max rating, tags.

I also want to sort by,

release date, rating.

Since in my assets table imdb_id is set as Partition Key. And I'm using Sort Key for storing DETAILS (contains all essential info (non-key) such as title, release date, rating, description, etc.) and RECOMMENDATION. SK in this format because, I needed a way to make lists of recommended movies for each movie, I could have supplied a field with the json of array objects as String or String Array, but since I am storing the movies' detail info anyways (and I'd want them to be available in the database as queryable items), it made much more sense to have them as separate records. So, I stored the original movie as a DETAILS record, I stored each recommended movie as a separate RECOMMENDATION#<imdb_id> record. Recommendations only contained the imdb_id of the recommended movie (which can be used to fetch DETAILS of the recommendation). And then finally I stored each of the recommended movie as a DETAILS record.

This way, I was able to keep a record of all of the recommendations against all movies while also storing the DETAILS info of those recommended movies too. I hope that makes sens3!

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744044144a4548861.html

相关推荐

  • java - Index Based Querying and Sorting - DynamoDb - Stack Overflow

    I am coming from an Android Application Development background. I am exploring DynamoDB and I've w

    9天前
    10

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信