• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
A Brief MongoDB Intro
 

A Brief MongoDB Intro

on

  • 2,096 views

A brief mongodb intro

A brief mongodb intro

Statistics

Views

Total Views
2,096
Views on SlideShare
2,096
Embed Views
0

Actions

Likes
1
Downloads
34
Comments
0

0 Embeds 0

No embeds

Accessibility

Categories

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

    A Brief MongoDB Intro A Brief MongoDB Intro Presentation Transcript

    • MongoDB
      • The Highly Scalable, Enterprise Grade, Open Source Database
    • NoSQL: A New Era of Databases
      • Big Data, Big Problem
      Scaling for the Demands of Modern Applications
    • Starting from Scratch
      • 10gen as an open source ‘ app engine ’ cloud platform
      • Backend storage needs
        • Agility
        • Scalability
        • Feature-richness
        • Performance
        • Ease of use
    • Agility
      • MongoDB is document-oriented.
      • JSON-like objects
      • ‘ Documents ’ are organized into ‘ Collections ’
      • Schema is not enforced
      > a = { name: “ mongo ” }; { “ name ” : “ mongo ” } >b = { x : 3 }; { “ x ” : 3 } > c = { x : 4 , j : 1 }; { “ x ” : 4 , “ j ” : 1 } >db.things.save(a) >db.things.save(b) >db.things.save(c) >db.things.find() { "_id" : ObjectId("4c2209f9f3924d31102bd84a"), "name" : "mongo" } { "_id" : ObjectId("4c2209fef3924d31102bd84b"), "x" : 3 } { "_id" : ObjectId("4c220a42f3924d31102bd856"), "x" : 4, "j" : 1 }
    • Deep Data
        • { _id : ObjectId("4c4ba5c0672c685e5e8aabf3"),
        • author : ” roger",
        • date : "Sat Jul 24 2010 19:47:11 GMT-0700 (PDT)",
        • text : " I love J.Biebs... ",
        • tags : [ ” rockstar", ” puppy-love" ],
        • comments_count: 1,
        • comments : [
        • {
        • author : ” Gretchen",
        • date : "Sat Jul 24 2010 20:51:03 GMT-0700 (PDT)",
        • text : ” Biebs is Toll!!!!"
        • }
        • ]}
    • Replication
      • Replication for high availability
      • Replica Sets
        • Auto-failover
        • Primary fails, secondary elected primary
        • Primary repaired, becomes secondary
      • Single-write node
      • Great for higher read volume
    • Replication Primary Secondary Secondary Secondary Secondary Client
    • Scalability
      • MongoDB features autosharding for horizontal scalability
      mongod mongod mongod mongos mongod mongod mongod Config Servers Shard Shard Shard Client
    • Sharding with Replica Sets mongod mongos mongod mongod mongod Config Servers Shard Shard Shard mongod mongod mongod mongod mongod mongod mongod mongod Client
    • Performance
      • Data Model
        • Dynamic
        • Deep data
      • In-place updates
      • Simplicity
    • Performance
      • milancermak.posterous.com
    • Performance
      • MongoDB test results:
      • siege -f ./stress_urls.txt -c 300 -r 10 -d1 -i
      • Transactions: 2994 hits
      • Availability: 99.80 %
      • Elapsed time: 11.95 secs
      • Data transferred: 3.19 MB
      • Response time: 0.26 secs
      • Transaction rate: 250.54 trans/sec
      • Throughput: 0.27 MB/sec
      • Concurrency: 65.03
      • Successful transactions: 2994
      • Failed transactions: 6
      • Longest transaction: 1.47
      • Shortest transaction: 0.00
              • MySQL test results:
              • siege -f ./stress_urls_mysql.txt -c 300 -r 10 -d1 -i
              • Transactions: 2832 hits
              • Availability: 94.40 %
              • Elapsed time: 23.53 secs
              • Data transferred: 2.59 MB
              • Response time: 0.74 secs
              • Transaction rate: 120.36 trans/sec
              • Throughput: 0.11 MB/sec
              • Concurrency: 89.43
              • Successful transactions: 2832
              • Failed transactions: 168
              • Longest transaction: 16.36
              • Shortest transaction: 0.00
      obvioushints.blogspot.com
    • Performance
      • bcbio.wordpress.com
    • Recent MongoDB Conferences
    • MongoDB Downloads
    • Production + Deployments
    • Thank you @mongodb [email_address] ; adam@10gen.com Mongo France, March 23 MongoSF, May 24 http://www.10gen.com/events http://bit.ly/mongofb Facebook | Twitter | LinkedIn http://linkd.in/joinmongo download at mongodb.org
    • (SQL vs MongoDB)
      • SQL Statement
      • Mongo Query Language Statement
      • CREATE TABLE USERS (a Number, b Number)
      • implicit; can be done explicitly
      • INSERT INTO USERS VALUES(1,1)
      • db.users.insert({a:1,b:1})
      • SELECT a,b FROM users
      • db.users.find({}, {a:1,b:1})
      • SELECT * FROM users
      • db.users.find()
      • SELECT * FROM users WHERE age=33
      • db.users.find({age:33})
      • SELECT a,b FROM users WHERE age=33
      • db.users.find({age:33}, {a:1,b:1})
      • SELECT * FROM users WHERE age=33 ORDER BY name
      • db.users.find({age:33}).sort({name:1})
      • SELECT * FROM users WHERE age>33
      • db.users.find({'age':{$gt:33}})})
      • SELECT * FROM users WHERE age<33
      • db.users.find({'age':{$lt:33}})})
      • SELECT * FROM users WHERE name LIKE &quot;%Joe%&quot;
      • db.users.find({name:/Joe/})
      • SELECT * FROM users WHERE name LIKE &quot;Joe%&quot;
      • db.users.find({name:/^Joe/})
      CREATE INDEX myindexname ON users(name,ts DESC) db.users.ensureIndex({name:1,ts:-1}) SELECT * FROM users WHERE a=1 and b='q' db.users.find({a:1,b:'q'}) SELECT * FROM users LIMIT 10 SKIP 20 db.users.find().limit(10).skip(20) SELECT * FROM users WHERE a=1 or b=2 db.users.find( { $or : [ { a : 1 } , { b : 2 } ] } ) SELECT * FROM users LIMIT 1 db.users.findOne() EXPLAIN SELECT * FROM users WHERE z=3 db.users.find({z:3}).explain() SELECT DISTINCT last_name FROM users db.users.distinct('last_name') SELECT COUNT(*y) FROM users db.users.count() SELECT COUNT(*y) FROM users where AGE > 30 db.users.find({age: {'$gt': 30}}).count()