Cheat-Code Sam
Cheat-Code Sam
DDeno
Created by Cheat-Code Sam on 5/25/2024 in #help
Indexing Items by Last Updated Time in Deno KV
Hello, I need some help with indexing in Deno KV. I have a list of threads, and each thread contains posts. When a post is added to a thread, I want to update the "last updated" timestamp for that thread. Additionally, I need to sort the threads by their "last updated" timestamp. I created a secondary index with the key space ['last_updated', lastUpdatedTime, threadId]. However, this approach results in duplicates because I can't remove the older "last updated" timestamps. My goal is to get a list of 200 unique threads, sorted by the "last updated" timestamp. How can I achieve this without getting duplicate entries for the same thread? Is there a way I can do this with secondary indexes?
13 replies