Database Reference
In-Depth Information
comment_id | downvotes | upvotes
--------------------+-----------+---------
be127... | 1 | 6
(1 rows)
cqlsh:weblog> select * from post_votes where post_id
= c06a42f0-22b2-11e4-a4f0-7f1a8b30f852;
post_id | downvotes | upvotes
------------+-----------+---------
c06a4... | 2 | 7
(1 rows)
Now, we want to facilitate the users of our blogging website with the ability to click on a
tag and see a list of all the posts with that tag. Here is what we do:
cqlsh:weblog> select * from categories where cat_name =
'maths' and blog_id = 83cec740-22b1-11e4-a4f0-7f1a8b30f852
order by blog_id desc;
cat_name | blog_id| post_id | post_title
----------+--------------+-----------+-------------------------
maths | 83cec... | a865c... | YARA
maths | 83cec... | c06a4... | Fooled by randomness...
(2 rows)
We can obviously use the pagination and sorting here. I think you have got the idea.
Sometimes, it is nice to see what people generally comment. It would be great if we could
find all the comments by a user. To make a nonprimary key field searchable in Cassandra,
you need to create an index on that column. So, let's do that:
Search WWH ::




Custom Search