MongoDB at RubyEnRails 2009

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.

0 comments

Post a comment

    Post a comment
    Embed Video
    Edit your comment Cancel

    Notes on slide 1

    Order Preserving Partitioning
    Split
    Migrate

    Process Diagram

    Global vs Targeted Operations
    Config Servers Use Two Phase Commit

    Server Layout

    blog post
    twitter

    1 Favorite

    MongoDB at RubyEnRails 2009 - Presentation Transcript

    1. open-source, high-performance, schema-free, document-oriented database
    2. RDBMS • Great for many applications • Shortcomings • Scalability • Availability • Flexibility
    3. Key-value stores
    4. CouchDB
    5. JSON-style documents
    6. Schema-free • Loosening constraints - added flexibility • Dynamically typed languages (like Ruby!) • Migrations
    7. Dynamic queries • Administration • Ease of development • Familiarity
    8. Focus on performance
    9. Replication
    10. Auto-sharding
    11. Many supported platforms / languages
    12. Good at • The web • Caching • High volume data • Scalability
    13. Less good at • Highly transactional • Ad-hoc business intelligence • Problems that require SQL
    14. MongoDB Basics
    15. Document • Unit of storage (think row) • BSON (Binary JSON) • Represented as a Hash
    16. Collection • Schema-free equivalent of a table • Logical groups of documents • Indexes are per-collection
    17. _id • Special key • Present in all documents • Unique across a Collection • Any type you want
    18. Blog back-end
    19. Post {:author => "mike", :date => Time.new, :text => "my blog post", :tags => ["mongodb", "ruby", "rer09"]}
    20. Comment {:author => “eliot”, :date => Time.new, :text => “great post!”}
    21. New post post = {:author => "mike", :date => Time.new, :text => "my blog post", :tags => ["mongodb", "ruby", "rer09"]} db[“posts”].save(post)
    22. Embedding a comment c = {:author => “eliot”, :date => Time.new, :text => “great post!”} db[“posts”].update({:_id => post[:_id]}, {:$push => {:comments => c}})
    23. Posts by author db[“posts”].find(:author => “mike”)
    24. Last 10 posts db[“posts”].find .sort([[:date, :desc]]) .limit(10)
    25. Posts in the last week last_week = Time.utc(2009, 10, 24) db[“posts”].find(:date => {:$gt => last_week})
    26. Posts ending with ‘RER’ db[“posts”].find(:text => /RER$/)
    27. Posts with a tag db[“posts”].find(:tags => “mongodb”) ... and fast db[“posts”].create_index(“tags”)
    28. Counting posts db[“posts”].count db[“posts”].find(:author => “mike”).count
    29. Basic paging page = 2 page_size = 15 db[“posts”].find.limit(page_size) .skip(page * page_size)
    30. Migration: adding titles • Easy - just start adding them: post = {:author => “mike”, :date => Time.new, :text => “another blog post”, :tags => [“rer09”], :title => “Review from RER 2009”} post_id = db[“posts”].save(post)
    31. Advanced queries • $gt, $lt, $gte, $lte, $ne, $all, $in, $nin • $where db[“posts”].find :$where => “this.author == ‘mike’ || this.title == ‘hello’”})
    32. MongoMapper, Mongoid, MongoRecord, etc.
    33. MongoMapper class User include MongoMapper::Document many :posts end class Post include MongoMapper::Document key :user_id, String key :title, String end user = User.create user.posts.create(:title => 'Foo') # would return post we just created user.posts.find_by_title('Foo')
    34. Other cool stuff • Aggregation and map reduce • Capped collections • Unique indexes • Mongo shell • GridFS
    35. Sharding
    36. Terminology • Shard key • Chunk • Range of the value space • (collection, key, min_val, max_val) • Shard • Single node (or replica pair) • Responsible for set of chunks
    37. • Download MongoDB http://www.mongodb.org • Try it out • Let us know what you think!
    38. • http://www.mongodb.org • irc.freenode.net#mongodb • mongodb-user on google groups • @mongodb, @mdirolf • mike@10gen.com • http://www.slideshare.net/mdirolf

    + Mike DirolfMike Dirolf, 3 weeks ago

    custom

    265 views, 1 favs, 0 embeds more stats

    Presentation on MongoDB given at RER09. The talk wa more

    More info about this document

    © All Rights Reserved

    Go to text version

    • Total Views 265
      • 265 on SlideShare
      • 0 from embeds
    • Comments 0
    • Favorites 1
    • Downloads 19
    Most viewed embeds

    more

    All embeds

    less

    Flagged as inappropriate Flag as inappropriate
    Flag as inappropriate

    Select your reason for flagging this presentation as inappropriate. If needed, use the feedback form to let us know more details.

    Cancel
    File a copyright complaint
    Having problems? Go to our helpdesk?

    Categories