• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content

Loading…

Flash Player 9 (or above) is needed to view presentations.
We have detected that you do not have it on your computer. To install it, go here.

Like this presentation? Why not share!

Introduction To MongoDB

on

  • 1,141 views

 

Statistics

Views

Total Views
1,141
Views on SlideShare
1,134
Embed Views
7

Actions

Likes
0
Downloads
31
Comments
0

1 Embed 7

http://lanyrd.com 7

Accessibility

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    Introduction To MongoDB Introduction To MongoDB Presentation Transcript

    • An introduction to
    • But First, A Little About Me
      My name’s Lee Theobald. Hello!
      Twitter: @Leesy
      Never updated blog: http://www.ltheobald.co.uk/
      I’m a developer at a small search company in Cambridge called Open Objects.
    • So what is MongoDB?
    • NoSQL database
      The name is short for humongous
      Open source with development lead by 10Gen (http://www.10gen.com)
      Document Based
      Schema-less
      Highly Scalable
      MapReduce
      Replication & Auto Sharding
    • Document Store
      Data is stored in the form of JSON data.
      {
      "_id" : ObjectId("4ccbfc75bd163019417c27f8"),
      "title": “Hello World! ",
      "author": {
      "firstname": "Joe",
      "lastname": "Bloggs"
      },
      "tags": ["test", "foo", "bar"]
      }
    • Familiar Structure
      MongoDB instances contain a number of databases which in turn contain a number of collections.
      Think of MySQL with it’s databases & tables.
      But collections can also be nested. E.g.
      customer_a(Database)
      logs_201009 (Collection)
      top_queries(Collection)
    • Inserts – Easy As Pie!
      use cookbook;
      db.desserts.save({
      name: "Cherry Pie",
      ingredients: ["cherries", "pie"],
      cooking_time: 30
      });
    • Searching – A Piece Of Cake
      db.recipes.find({
      cooking_time: { “$gte”: 10, “$lt”: 30}
      })
      db.recipes.findOne()
    • Some More Advanced Query Syntax
      Limiting
      db.find().limit(10);
      Skipping
      db.find( ).skip(5);
      Sorting
      db.find({…}).sort({cooking_time: “-1”});
      Cursors
      var cur = db.find({…}).cursor()
      cur.forEach( function(x) { print(tojson(x)) });
    • MapReduce
      Great way of doing bulk manipulation or aggregation.
      2 or 3 functions written in JavaScriptthat execute on the server.
      An example use could be generating a list of top queries from some search logs.
    • Map Function
      Takes some input of the form of key/value pairs.
      Does something with that
      Returns 0 or more key/value pairs
      map = function() {
      if (!this.query) {
      return;
      }
      emit (this.query, {count: 1});
      }
    • Reduce Function
      Takes the results from the map function
      Does something (normally combine the results)
      Produces output in key/value pairs
      reduce = function(key, values) {
      var count = 0;
      values.forEach(function(v) {
      count += v[‘count’];
      }
      return {count: count;}
      }
    • Replica Sets
      Master/Slave configuration
      If your primary server goes down, one of the secondary ones takes over.
    • Auto Sharding
    • But Why Not Try It Yourself
      Download it at: http://www.mongodb.org
      Online tutorial at:http://www.mongodb.org/display/DOCS/Tutorial
      Some handy MongoDB sites:
      MongoDB Cookbook: http://cookbook.mongodb.org/
      Kyle Banker’s blog: http://kylebanker.com/blog/
    • Thanks For Listening.Any (easy)Questions?