MongoDB at RuPy
Upcoming SlideShare
Loading in...5
×
 

MongoDB at RuPy

on

  • 3,806 views

Presentation on MongoDB given at RuPy in November of 2009.

Presentation on MongoDB given at RuPy in November of 2009.

Statistics

Views

Total Views
3,806
Views on SlideShare
3,793
Embed Views
13

Actions

Likes
8
Downloads
45
Comments
0

3 Embeds 13

http://www.slideshare.net 7
http://www.techgig.com 5
http://115.112.206.131 1

Accessibility

Categories

Upload Details

Uploaded via as Apple Keynote

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
  • Order Preserving Partitioning <br /> Split <br /> Migrate
  • Server Layout
  • blog post <br /> twitter

MongoDB at RuPy MongoDB at RuPy Presentation Transcript

  • open-source, high-performance, schema-free, document-oriented database
  • RDBMS • Great for many applications • Shortcomings • Scalability • Availability • Flexibility
  • Key-value stores
  • CouchDB
  • JSON-style documents
  • Schema-free • Loosening constraints - added flexibility • Dynamically typed languages (RuPy!) • Migrations
  • Dynamic queries • Administration • Ease of development • Familiarity
  • Focus on performance
  • Replication
  • Auto-sharding
  • Many supported platforms / languages
  • Good at • The web • Caching • High volume data • Scalability
  • Less good at • Highly transactional • Ad-hoc business intelligence • Problems that require SQL
  • MongoDB Basics
  • Document • Unit of storage (think row) • BSON (Binary JSON) • Represented as a dict / Hash
  • Collection • Schema-free equivalent of a table • Logical groups of documents • Indexes are per-collection
  • _id • Special key • Present in all documents • Unique across a Collection • Any type you want
  • Blog back-end
  • Post {“author”: “mike”, “date”: datetime.datetime.utcnow(), “text”: “my blog post...”, “tags”: [“mongodb”, “python”, “ruby”]}
  • Comment {“author”: “eliot”, “date”: datetime.datetime.utcnow(), “text”: “great post!”}
  • New post post = {“author”: “mike”, “date”: datetime.datetime.utcnow(), “text”: “my blog post...”, “tags”: [“mongodb”, “python”, “ruby”]} post_id = db.posts.save(post)
  • Embedding a comment c = {“author”: “eliot”, “date”: datetime.datetime.utcnow(), “text”: “great post!”} db.posts.update({“_id”: post_id}, {“$push”: {“comments”: c}})
  • Posts by author db.posts.find({“author”: “mike”})
  • Last 10 posts query = db.posts.find() .sort(“date”, DESCENDING) .limit(10) for post in query: print post[“text”]
  • Posts in the last week last_week = datetime.datetime.utcnow() + datetime.timedelta(days=-7) db.posts.find({“date”: {“$gt”: last_week}})
  • Posts ending with ‘RuPy’ db.posts.find({“text”: re.compile(“RuPy$”)})
  • Posts with a tag db.posts.find({“tags”: “mongodb”}) ... and fast db.posts.create_index(“tags”)
  • Counting posts db.posts.count() db.posts.find({“author”: “mike”}).count()
  • Basic paging page = 2 page_size = 15 db.posts.find().limit(page_size) .skip(page * page_size)
  • 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)
  • Advanced queries • $gt, $lt, $gte, $lte, $ne, $all, $in, $nin • where() db.posts.find().where(“this.author==‘mike’ || this.title==‘hello’”) • group()
  • Other cool stuff • Aggregation and map reduce • Capped collections • Unique indexes • Mongo shell • GridFS • MongoKit, Mongoid, MongoMapper, etc.
  • Sharding
  • 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
  • client
  • mongos client
  • Shards mongod mongod mongod ... mongod mongod mongod mongos client
  • Shards mongod mongod mongod ... mongod mongod mongod mongos mongos ... client
  • Shards mongod mongod mongod ... Config mongod mongod mongod Servers mongod mongod mongod mongos mongos ... client
  • • Download MongoDB http://www.mongodb.org • Try it out • Let us know what you think! • Oh, and get stickers!
  • • http://www.mongodb.org • irc.freenode.net#mongodb • mongodb-user on google groups • @mongodb, @mdirolf • mike@10gen.com • http://www.slideshare.net/mdirolf