admin管理员组文章数量:1356334
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!
本文标签: javaIndex Based Querying and SortingDynamoDbStack Overflow
版权声明:本文标题:java - Index Based Querying and Sorting - DynamoDb - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744044144a2581211.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论