Your SlideShare is downloading. ×
An Introduction To NoSQL & MongoDB
Upcoming SlideShare
Loading in...5

Thanks for flagging this SlideShare!

Oops! An error has occurred.

Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

An Introduction To NoSQL & MongoDB


Published on

My talk on NoSQL & MongoDB from Refresh Cambridge, July 2011

My talk on NoSQL & MongoDB from Refresh Cambridge, July 2011

Published in: Business, Technology

1 Comment
No Downloads
Total Views
On Slideshare
From Embeds
Number of Embeds
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

No notes for slide


  • 1. An Introduction ToNoSQL & MongoDB
    Lee Theobald
    Twitter: @Leesy
  • 2. NoSQL
    A form of database management system that is non-relational.
    Systems are often schema less, avoid joins & are easy to scale.
    The term NoSQL was coined in 1998 by Carlo Strozzi and then again in early 2009 with the no:sql(east) conference
    A better term would have been “NoREL” but NoSQL caught on. Think of it more as meaning “Not Only SQL”
  • 3. But Why Choose NoSQL?
    Amount of data stored is on the up & up.
    Facebook is rumoured to hold over 50TB of data in their NoSQL system for their inbox search
    The data we store is more complex than 15 years ago.
    Easy Distribution
    With all this data is needs to be easy to be able to add/remove servers without any disruption of service.
  • 4. Choose Your Flavour
    Key-Value Store
    Document Store
  • 5. Key-Value Store
    Data is stored in (unsurpisingly) key/value pairs.
    Designed to handle lots of data and heavy load
    Based on a Amazon’s Dynamo Paper
    Example: Voldermort ( - Developed by the guys at LinkedIn
  • 6. Graph
    Focuses on modeling data & associated connections
    Inspired by mathematical Graph Theory.
    Example: FlockDB ( – developed by Twitter
  • 7. BigTable / Column Families
    Based on the BigTable paper from Google
    Data is grouped by columns, not rows.
    Example: Cassandra ( – Originally developed by Facebook, now and Apache project.
  • 8. Document Store
    Data stored as whole documents.
    JSON & XML are popular formats
    Maps well to an Object Orientated programming model
    Example: CouchDB ( or …
    “id”: “123”,
    “name”: “Oliver Clothesoff”,
    “dob”: {
    “year”: 1985,
    “month”: 5,
    “day”: 12
  • 9. MongoDB!
    Short for humongous
    Open source with development lead by 10Gen
    Document Based
    Highly Scalable
    Easy Replication & Sharding
  • 10. Familiar Structure
    A MongoDB instance is made up of a number of databases.
    These contain a number of collections & you can have collections nested under other collections.
    Compare it to MySQL which has databases and tables.
  • 11. Inserts – As Easy As Pie
    use cookbook;{
    “name”: “Cherry Pie”,
    “ingredients”: [“cherries”, “pie”],
    “cooking_time”: 30
  • 12. Searching – A Piece Of Cake!{
    “cooking_time”: { “$gte”: 10, “$lt”: 30 }
  • 13. Some More Advanced Syntax
    Limiting Results
    Skipping results
    db.find().sort({cooking_time: -1});
    var cur = db.find().cursor();
    cur.forEach( function(x) { print(tojson(x)); });
  • 14. MapReduce
    Great way of doing bulk manipulation or aggregation.
    2 or 3 functions written in JavaScript that execute on the server.
    An example use could be generating a list of top queries from some search logs.
  • 15. Map Function
    Takes some input of the form of key/value pairs, performs some calculations and returns 0 or more key/value pairs
    map = function() {
    if (!this.query) {
    emit (this.query, {count: 1});
  • 16. Reduce Function
    Takes the results from the map function, does something (normally combine the results) and produces output in key/value pairs
    reduce = function(key, values) {
    var count = 0;
    values.forEach(function(v) {
    count += v[‘count’];
    return {count: count;}
  • 17. Replica Sets
    Master/Slave configuration
    If your primary server goes down, one of the secondary ones takes overautomatically
    Extremely easy to setup
  • 18. Auto Sharding – Horizontal Scaling
  • 19. Other Features
    GridFS support – Distributed file storage
    Geospatial indexing
    It’s constantly in development so new features are being worked on all the time!
  • 20. Why Not Try It Yourself
    Download it at:
    Online tutorial at:
    Some handy MongoDB sites:
    MongoDB Cookbook:
    Kyle Banker’s blog:
    There’salso a load of handyreferencecards, stickers and otherMongoDBfreebiesupfront!
  • 21. Thanks For Listening
    Any questions?