how to Solve the "Digg" problem in MongoDB

Posted by user193116 on Stack Overflow See other posts from Stack Overflow or by user193116
Published on 2010-05-12T22:19:00Z Indexed on 2010/05/12 22:24 UTC
Read the original article Hit count: 245

Filed under:
|
|
|

A while back,a Digg developer had posted this blog ,"http://about.digg.com/blog/looking-future-cassandra", where the he described one of the issues that were not optimally solved in MySQL. This was cited as one of the reasons for their move to Cassandra.

I have been playing with MongoDB and I would like to understand how to

implement the MongoDB collections for this problem

From the article, the schema for this information in MySQL :

CREATE TABLE Diggs ( id INT(11), itemid INT(11), userid INT(11), digdate DATETIME, PRIMARY KEY (id), KEY user (userid), KEY item (itemid) ) ENGINE=InnoDB DEFAULT CHARSET=utf8;

CREATE TABLE Friends ( id INT(10) AUTO_INCREMENT, userid INT(10), username VARCHAR(15), friendid INT(10), friendname VARCHAR(15), mutual TINYINT(1), date_created DATETIME, PRIMARY KEY (id), UNIQUE KEY Friend_unique (userid,friendid), KEY Friend_friend (friendid) ) ENGINE=InnoDB DEFAULT CHARSET=utf8;

This problem is ubiquitous in social networking scenario implementation. People befriend a lot of people and they in turn digg a lot of things. Quickly showing a user what his/her friends are up to is very critical.

I understand that several blogs have since then provided a pure RDBMs solution with indexes for this issue; however I am curious as to how this could be solved in MongoDB.

© Stack Overflow or respective owner

Related posts about nosql

Related posts about mongodb