Book Image

Learning Apache Cassandra

By : Matthew Brown
4 (1)
Book Image

Learning Apache Cassandra

4 (1)
By: Matthew Brown

Overview of this book

Table of Contents (19 chapters)
Learning Apache Cassandra
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Chapter 5. Establishing Relationships

At this point, we might declare our MyStatus application a minimum viable product. Users can create accounts and post status updates, and those status updates can be viewed in their authors' timelines. And, of course, since we're storing the data in Cassandra, we don't need to worry about scaling up to millions of users or billions of status updates.

As our service grows, however, it would be nice for users to be able to view all their friends' status updates in one place. The first step of that, of course, would be to know who a user's friends are. So, we'll build a feature that allows one user to follow another.

We've already seen a good way to use Cassandra to model a specific type of relationship. Compound primary keys are a natural fit for parent-child associations but a follow relationship is many-to-many: I follow many users, and—hopefully—many users follow me.

In this chapter, we'll build on our knowledge of Cassandra data modeling and introduce...