Your SlideShare is downloading. ×
MongoDB at RuPy
MongoDB at RuPy
MongoDB at RuPy
MongoDB at RuPy
MongoDB at RuPy
MongoDB at RuPy
MongoDB at RuPy
MongoDB at RuPy
MongoDB at RuPy
MongoDB at RuPy
MongoDB at RuPy
MongoDB at RuPy
MongoDB at RuPy
MongoDB at RuPy
MongoDB at RuPy
MongoDB at RuPy
MongoDB at RuPy
MongoDB at RuPy
MongoDB at RuPy
MongoDB at RuPy
MongoDB at RuPy
MongoDB at RuPy
MongoDB at RuPy
MongoDB at RuPy
MongoDB at RuPy
MongoDB at RuPy
MongoDB at RuPy
MongoDB at RuPy
MongoDB at RuPy
MongoDB at RuPy
MongoDB at RuPy
MongoDB at RuPy
MongoDB at RuPy
MongoDB at RuPy
MongoDB at RuPy
MongoDB at RuPy
MongoDB at RuPy
MongoDB at RuPy
MongoDB at RuPy
MongoDB at RuPy
MongoDB at RuPy
MongoDB at RuPy
MongoDB at RuPy
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

MongoDB at RuPy

2,616

Published on

Presentation on MongoDB given at RuPy in November of 2009.

Presentation on MongoDB given at RuPy in November of 2009.

Published in: Technology
0 Comments
9 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
2,616
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
48
Comments
0
Likes
9
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide
  • Order Preserving Partitioning
    Split
    Migrate
  • Server Layout
  • blog post
    twitter
  • 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 (RuPy!) • 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 dict / 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”: datetime.datetime.utcnow(), “text”: “my blog post...”, “tags”: [“mongodb”, “python”, “ruby”]}
    • 20. Comment {“author”: “eliot”, “date”: datetime.datetime.utcnow(), “text”: “great post!”}
    • 21. New post post = {“author”: “mike”, “date”: datetime.datetime.utcnow(), “text”: “my blog post...”, “tags”: [“mongodb”, “python”, “ruby”]} post_id = db.posts.save(post)
    • 22. Embedding a comment c = {“author”: “eliot”, “date”: datetime.datetime.utcnow(), “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 query = db.posts.find() .sort(“date”, DESCENDING) .limit(10) for post in query: print post[“text”]
    • 25. Posts in the last week last_week = datetime.datetime.utcnow() + datetime.timedelta(days=-7) db.posts.find({“date”: {“$gt”: last_week}})
    • 26. Posts ending with ‘RuPy’ db.posts.find({“text”: re.compile(“RuPy$”)})
    • 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”: datetime.datetime.utcnow(), “text”: “another blog post...”, “tags”: [“conference”, “rupy”], “title”: “Review from RuPy”} 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’”) • group()
    • 32. Other cool stuff • Aggregation and map reduce • Capped collections • Unique indexes • Mongo shell • GridFS • MongoKit, Mongoid, MongoMapper, etc.
    • 33. Sharding
    • 34. 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
    • 35. client
    • 36. mongos client
    • 37. Shards mongod mongod mongod ... mongod mongod mongod mongos client
    • 38. Shards mongod mongod mongod ... mongod mongod mongod mongos mongos ... client
    • 39. Shards mongod mongod mongod ... Config mongod mongod mongod Servers mongod mongod mongod mongos mongos ... client
    • 40. • Download MongoDB http://www.mongodb.org • Try it out • Let us know what you think! • Oh, and get stickers!
    • 41. • http://www.mongodb.org • irc.freenode.net#mongodb • mongodb-user on google groups • @mongodb, @mdirolf • mike@10gen.com • http://www.slideshare.net/mdirolf

    ×