Your SlideShare is downloading. ×
0
open-source, high-performance, document-oriented database Antoine Girbal [email_address]
RDBMS (Oracle, MySQL) New Gen. OLAP (vertica, aster, greenplum) Non-relational Operational Stores (“NoSQL”) RDBMS Helper (...
<ul><li>non-relational, next-generation operational datastores and databases </li></ul><ul><li>focus on scalability </li><...
Horizontally Scalable Architectures no joins no complex transactions +
JSON-style Documents {  hello :   “world”  } x16x00x00x00 x02 hellox00 x06x00x00x00worldx00 x00 http://bsonspec.org repres...
Flexible “Schemas” In collection db.posts: {author: “mike”, links: 3 , date: &quot;Sun Jul 18 2010 14:40:20 GMT-0700 (PDT)...
Embedded Document { _id: ObjectId(&quot;4d1009c7262bb4b94af1cea4&quot;) author_id: “1346”, date: &quot;Sun Jul 18 2010 14:...
Data Model Normalized: Many tables Row/Column Natural: Collections Documents Just BLOBS Can't scale As fast as BLOBs if we...
Features <ul><li>Complex querying </li></ul><ul><li>Atomic updates with modifiers </li></ul><ul><li>Indexing (unique, comp...
Replication master slave slave Using Replica Set: - pool of servers with 1 master - automatic master election and failover...
Sharding client mongos ... mongos mongod ... Shards mongod mongod mongod Config Servers mongod mongod mongod mongod mongod...
Support <ul><li>OS: Mac OS X, Windows, Linux, Solaris, 32/64 bits </li></ul><ul><li>Drivers: C, C#, C++, Haskell, Java, Ja...
Production Examples <ul><li>Shutterfly </li></ul><ul><li>Fourquare </li></ul><ul><li>Craigslist </li></ul><ul><li>bit.ly <...
New Post > post = {author: &quot;mike&quot;, ... date: new Date(), ... text: &quot;my blog post&quot;, ... tags: [&quot;mo...
A Quick Aside <ul><li>special key </li></ul><ul><li>present in all documents </li></ul><ul><li>unique across a Collection ...
Update > db.posts.update({_id: post._id}, ... { $set: {author: &quot;tony&quot;}}) > c = {author: &quot;eliot&quot;, date:...
Querying > db.posts.findOne() { &quot;_id&quot; : ObjectId(&quot;4d2f944103e8fdbb36f6d205&quot;), &quot;author&quot; : &qu...
More Querying Find by Author > db.posts.find({author: &quot;tony&quot;}) 10 most recent posts: > db.posts.find().sort({dat...
More Querying Find with regexp: > db.posts.find({text: /post$/}) Find within array: > db.posts.find({tags: &quot;intro&quo...
More Querying Counting: > db.posts.find().count() > db.posts.find({author: &quot;tony&quot;}).count() Paging: > page = 2 >...
Download MongoDB http://www.mongodb.org and let us know what you think @mongodb Current 1.6, soon 1.8
Upcoming SlideShare
Loading in...5
×

2011 Mongo FR - MongoDB introduction

1,787

Published on

An introduction to the open source, document-oriented database and its features.

0 Comments
2 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
1,787
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
61
Comments
0
Likes
2
Embeds 0
No embeds

No notes for slide
  • Collection (logical groupings of documents) Indexes are per-collection
  • blog post twitter
  • Transcript of "2011 Mongo FR - MongoDB introduction"

    1. 1. open-source, high-performance, document-oriented database Antoine Girbal [email_address]
    2. 2. RDBMS (Oracle, MySQL) New Gen. OLAP (vertica, aster, greenplum) Non-relational Operational Stores (“NoSQL”) RDBMS Helper (MemCache, Application layer) Data Store Analytics
    3. 3. <ul><li>non-relational, next-generation operational datastores and databases </li></ul><ul><li>focus on scalability </li></ul><ul><li>ease of modeling and changing data </li></ul><ul><li>(also no sql syntax, thanks!) </li></ul>NoSQL Really Means:
    4. 4. Horizontally Scalable Architectures no joins no complex transactions +
    5. 5. JSON-style Documents { hello : “world” } x16x00x00x00 x02 hellox00 x06x00x00x00worldx00 x00 http://bsonspec.org represented as BSON Just like a light and friendly XML
    6. 6. Flexible “Schemas” In collection db.posts: {author: “mike”, links: 3 , date: &quot;Sun Jul 18 2010 14:40:20 GMT-0700 (PDT)&quot; text: “blah blah”} {author: “eliot”, date: &quot;Sun Jul 18 2010 14:40:22 GMT-0700 (PDT)&quot; text: “Here is MongoDB ...”, views: 10 } Potentially all documents in the same collection
    7. 7. Embedded Document { _id: ObjectId(&quot;4d1009c7262bb4b94af1cea4&quot;) author_id: “1346”, date: &quot;Sun Jul 18 2010 14:40:20 GMT-0700 (PDT)&quot;, title: “my story” text: “once upon a time ...”, tags: [“novel”,”english”], Comments:[ {user_id: 234, text: “awesome dude”}, {user_id: 1235, text: “that made me cry”}] } little need for joins or transactions across documents!
    8. 8. Data Model Normalized: Many tables Row/Column Natural: Collections Documents Just BLOBS Can't scale As fast as BLOBs if well modeled, horizontal scalability Easy to scale (Dynamo), can easily use caching No feature Most regular SQL features (satisfies 90% of users) (too) many PERFORMANCE FEATURES
    9. 9. Features <ul><li>Complex querying </li></ul><ul><li>Atomic updates with modifiers </li></ul><ul><li>Indexing (unique, compound, Geo) </li></ul><ul><li>Aggregation and Map / Reduce </li></ul><ul><li>Capped Collections </li></ul><ul><li>Powerful Shell (Javascript) </li></ul><ul><li>GridFS: file storage </li></ul>
    10. 10. Replication master slave slave Using Replica Set: - pool of servers with 1 master - automatic master election and failover - distributed reads (slaveOk) slave Client Client
    11. 11. Sharding client mongos ... mongos mongod ... Shards mongod mongod mongod Config Servers mongod mongod mongod mongod mongod mongod mongod mongod ... For large datasets, or write heavy system
    12. 12. Support <ul><li>OS: Mac OS X, Windows, Linux, Solaris, 32/64 bits </li></ul><ul><li>Drivers: C, C#, C++, Haskell, Java, Javascript, Perl, PHP, Python, Ruby, Scala... + community drivers </li></ul><ul><li>Open-source project with active community, Wiki, Google Group, 10gen consulting / support </li></ul>
    13. 13. Production Examples <ul><li>Shutterfly </li></ul><ul><li>Fourquare </li></ul><ul><li>Craigslist </li></ul><ul><li>bit.ly </li></ul><ul><li>IGN </li></ul><ul><li>Sourceforge </li></ul><ul><li>Etsy </li></ul><ul><li>the New York Times </li></ul><ul><li>Business Insider </li></ul><ul><li>Gilt Groupe </li></ul><ul><li>Intuit </li></ul><ul><li>College humor </li></ul><ul><li>Evite </li></ul><ul><li>Disqus </li></ul><ul><li>Justin.tv </li></ul><ul><li>Heartbeat </li></ul><ul><li>Hot Potato </li></ul><ul><li>Eventbrite </li></ul><ul><li>Sugar crm </li></ul><ul><li>Electronic Arts </li></ul><ul><li>... </li></ul>
    14. 14. New Post > post = {author: &quot;mike&quot;, ... date: new Date(), ... text: &quot;my blog post&quot;, ... tags: [&quot;mongodb&quot;, &quot;intro&quot;]} > db.posts.save(post) > db.posts.findOne() { &quot;_id&quot; : ObjectId(&quot;4d2f944103e8fdbb36f6d205&quot;), &quot;author&quot; : &quot;mike&quot;, &quot;date&quot; : ISODate(&quot;2011-01-14T00:08:49.933Z&quot;), &quot;text&quot; : &quot;my blog post&quot;, &quot;tags&quot; : [&quot;mongodb&quot;,&quot;intro&quot;]}
    15. 15. A Quick Aside <ul><li>special key </li></ul><ul><li>present in all documents </li></ul><ul><li>unique across a Collection </li></ul><ul><li>any type you want </li></ul>_id
    16. 16. Update > db.posts.update({_id: post._id}, ... { $set: {author: &quot;tony&quot;}}) > c = {author: &quot;eliot&quot;, date: new Date(), text: &quot;great post!&quot;} > db.posts.update({_id: post._id}, ... { $push: {comments: c}}) > db.posts.update({_id: post._id}, ... { $inc: {views: 1}})
    17. 17. Querying > db.posts.findOne() { &quot;_id&quot; : ObjectId(&quot;4d2f944103e8fdbb36f6d205&quot;), &quot;author&quot; : &quot;tony&quot;, &quot;comments&quot; : [ { &quot;author&quot; : &quot;eliot&quot;, &quot;date&quot; : ISODate(&quot;2011-01-14T00:13:52.463Z&quot;), &quot;text&quot; : &quot;great post!&quot; } ], &quot;date&quot; : ISODate(&quot;2011-01-14T00:08:49.933Z&quot;), &quot;tags&quot; : [ &quot;mongodb&quot;, &quot;intro&quot; ], &quot;text&quot; : &quot;my blog post&quot;, &quot;views&quot; : 1 }
    18. 18. More Querying Find by Author > db.posts.find({author: &quot;tony&quot;}) 10 most recent posts: > db.posts.find().sort({date: -1}).limit(10) Posts since April 1 st : > april_1 = new Date(2010, 3, 1) > db.posts.find({date: {$gt: april_1}}) Adding an index to speed up: > db.posts.ensureIndex({author: 1}) > db.posts.ensureIndex({date: 1})
    19. 19. More Querying Find with regexp: > db.posts.find({text: /post$/}) Find within array: > db.posts.find({tags: &quot;intro&quot;}) > db.posts.ensureIndex({tags: 1}) Find within embedded object: > db.posts.find({&quot;comments.author&quot;: &quot;eliot&quot;}) > db.posts.ensureIndex({&quot;comments.author&quot;: 1})
    20. 20. More Querying Counting: > db.posts.find().count() > db.posts.find({author: &quot;tony&quot;}).count() Paging: > page = 2 > page_size = 15 > db.post.find().limit(page_size).skip(page * page_size) Advanced operators: $gt, $lt, $gte, $lte, $ne, $all, $in, $nin, $where > db.posts.find({$where: &quot;this.author == 'tony' || this.title == 'foo'&quot;})
    21. 21. Download MongoDB http://www.mongodb.org and let us know what you think @mongodb Current 1.6, soon 1.8
    1. A particular slide catching your eye?

      Clipping is a handy way to collect important slides you want to go back to later.

    ×