While the Digg developer posted this blog, http://about.digg.com/blog/looking-future-cassandra ", where he described one of the problems that were not optimized in MySQL. This was called one of the reasons they moving to Kassandra.
I played with MongoDB and I would like to understand how
implement 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 the implementation of social media scenarios. People are friends with many people, and they, in turn, find a lot of things. Quickly showing the user that his / her friends are very important.
I understand that since then, several blogs have provided a clean RDBM solution with indexes for this problem; however, I am curious how this can be solved in MongoDB.