MongoDB at CodeMash 2.0.1.0

4,836
-1

Published on

Presentation on MongoDB from CodeMash 2010 in Sandusky

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

No Downloads
Views
Total Views
4,836
On Slideshare
0
From Embeds
0
Number of Embeds
9
Actions
Shares
0
Downloads
102
Comments
0
Likes
5
Embeds 0
No embeds

No notes for slide
  • Collection (logical groupings of documents)
    Indexes are per-collection
  • blog post
    twitter
  • MongoDB at CodeMash 2.0.1.0

    1. open-source, high-performance, schema-free, document-oriented database
    2. One-Size-Fits-All No Longer RDBMS (Oracle, MySQL) Non-relational New gen. OLAP (vertica, aster, greenplum) operational stores (“NoSQL”)
    3. NoSQL really means: non-relational next generation operational datastores and databases
    4. Scaling out no joins + light transactional semantics = horizontally scalable architectures
    5. Data models no joins + light transactional semantics = horizontally scalable architectures important side effect : new data models = improved ways to develop applications
    6. Data Models Key/Value Tabular Document-based
    7. Data Models Key/Value memcached, dynamo, voldemort Tabular bigtable, cassandra, hbase, hypertable Document-oriented mongodb, couchdb. JSON stores
    8. JSON-style documents
    9. Schema-free • Loosening constraints - added flexibility • Dynamically typed languages • Migrations
    10. Dynamic queries • Administration • Ease of development • Familiarity
    11. Focus on performance
    12. Replication
    13. Auto-sharding
    14. Many supported platforms / languages
    15. Good at • The web • Caching • High volume data • Scalability
    16. Less good at • Highly transactional • Ad-hoc business intelligence • Problems that require SQL
    17. MongoDB Basics
    18. Document • Unit of storage (think row) • BSON (Binary JSON) • Represented is language dependent
    19. Collection • Schema-free equivalent of a table • Logical groups of documents • Indexes are per-collection
    20. _id • Special key • Present in all documents • Unique across a Collection • Any type you want
    21. Blog back-end
    22. Post {author: “mike”, date: new Date(), text: “my blog post...”, tags: [“mongodb”, “codemash”]}
    23. Comment {author: “eliot”, date: new Date(), text: “great post!”}
    24. New post post = {author: “mike”, date: new Date(), text: “my blog post...”, tags: [“mongodb”, “codemash”]} db.posts.save(post)
    25. Embedding a comment c = {author: “eliot”, date: new Date(), text: “great post!”} db.posts.update({_id: post._id}, {$push: {comments: c}})
    26. Posts by author db.posts.find({author: “mike”})
    27. Last 10 posts db.posts.find() .sort({date: -1}) .limit(10)
    28. Posts in the last week last_week = new Date(2010, 0, 6) db.posts.find({date: {$gt: last_week}})
    29. Posts ending with ‘Mash’ db.posts.find({text: /Mash$/})
    30. Posts with a tag db.posts.find({tags: “mongodb”}) ... and fast db.posts.ensureIndex({tags: 1})
    31. Counting posts db.posts.count() db.posts.find({author: “mike”}).count()
    32. Basic paging page = 2 page_size = 15 db.posts.find().limit(page_size) .skip(page * page_size)
    33. Migration: adding titles • Easy - just start adding them: post = {author: “mike”, date: new Date(), text: “another blog post...”, tags: [“codemash”], title: “Review from CodeMash”} post_id = db.posts.save(post)
    34. Advanced queries • $gt, $lt, $gte, $lte, $ne, $all, $in, $nin • where() db.posts.find({$where: “this.author == ‘mike’”})
    35. Other cool stuff • Aggregation and map reduce • Capped collections • Unique indexes • Mongo shell • GridFS
    36. • Download MongoDB http://www.mongodb.org • Try it out • Let us know what you think!
    37. • http://www.mongodb.org • irc.freenode.net#mongodb • mongodb-user on google groups • @mongodb, @mdirolf • mike@10gen.com • http://www.slideshare.net/mdirolf
    1. A particular slide catching your eye?

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

    ×