MongoDB project for college students

922 views
Skip to first unread message

irek02

unread,
May 21, 2012, 9:57:42 PM5/21/12
to mongod...@googlegroups.com
Hello dear MongoDB community,
I was assigned to come up with way (as a programming project for undergrad/grad students) to demonstrate how MongoDB can solve problems that are common for RDBMSs. After making a research on the number of use cases I concluded that every company has listed at least those two features as the reasons to switch to MongoDB:
  1. Replica sets and autosharding.
  2. Schema-free document data model.

It's obvious that the second item is more applicable for the small undergrad/grad student project.

What kind of coding example do you think would show the benefits of using schema-free data model comparing to RDBMSs?

P.S. One of my approaches was to find some application that uses RDBMS database (e.g. Magento's), which can get really messy and complicated through out its life cycle (presentation on that topic), and have the students implement the same schema but in MongoDB. So they could see on practice how using MongoDB's flexible schema model allows to avoid "hardwired schema" problems in RDBMSs. The problem with this approach is that it requires a lot of extra work, which is building the app, similar to Magento by its functionality, but which uses MongoDB.

P.S.S The hard thing is that the students have to find it out on themselves that in some cases using schema-free DBMS might be very beneficial, while doing this assignment .

Any ideas will be very appreciated! Thanks in advance!

Francium Kriheli

unread,
May 21, 2012, 10:11:30 PM5/21/12
to mongod...@googlegroups.com
Craigslist's migration to MongoDB offers a great example of how schema-free datastores can be beneficial for frequently changing information.

 Craigslist has been around for years, and when it came to archiving data, they realized that they were trying to archive a lot of valuable information that had changed throughout the years. The tables that they used in MySQL were not easy to adjust; it was difficult to add an additional value such as an address line or twitter handle to a posting. MongoDB helped them solve this problem; with the schema-free solution, allowing them to adjust the shape of their data at any time. 

Here's a good write-up: 

--
You received this message because you are subscribed to the Google
Groups "mongodb-user" group.
To post to this group, send email to mongod...@googlegroups.com
To unsubscribe from this group, send email to
mongodb-user...@googlegroups.com
See also the IRC channel -- freenode.net#mongodb

Sam Millman

unread,
May 22, 2012, 3:40:02 AM5/22/12
to mongod...@googlegroups.com
"What kind of coding example do you think would show the benefits of using schema-free data model comparing to RDBMSs?"

One thing is dynamic statistics tables allowing for pivotal information handling in realtime which SQL can't do.

There are so many more comparisons like that. I mean consider uses for memcached. Mongo can cache just like memcached and provide a more robust version (so hot is in memcached but cloder is in mongo while stale is in SQL).

Magento do something truely evil with their DB, they use a slow and cumbersome data structure to try to emulate the schemaless nature of NoSQL in a DB that isn't designed for it.

The schemaless structure can also be benefical for a couple of other reasons:

- If you do your queries right you dont need to worry about trying to call the db as few times as possible
- The cursor is a streamer not a in memory view of the table results (can be a bad thing too)
- embedded docs make normalisation of many->many relationships easy
- Due to Mongo's ability to query so many times and so quickly it can tend to be easier to implement it into applications than other DBs such as SQL where you need to consider every position of every call.

But it's schemaless nature can also make programming standards such as ActiveRecord or Doctrine or PDO type accessors harder due to not being able to call "get fields" on the collections.

Sam Millman

unread,
May 22, 2012, 4:00:17 AM5/22/12
to mongod...@googlegroups.com
Actually you can see a quick example of one place where schemaless design works well here:

http://sammaye.wordpress.com/2012/05/22/realtime-stats-in-mongodb-example/

I am recording video views there. At the top you will see my statistic row, recordHit() fills that schema and getStatistics_dateRange() does...well you can prolly guess :)

This is only a rough example that I had lying around that I pasted for you so yea it comes with its risks.
Reply all
Reply to author
Forward
0 new messages