MongoDB Grand Rapids RUG
Upcoming SlideShare
Loading in...5
×
 

Like this? Share it with your network

Share

MongoDB Grand Rapids RUG

on

  • 13,813 views

Don't know if it is worthwhile without me explaining the points but I'll post them anyway.

Don't know if it is worthwhile without me explaining the points but I'll post them anyway.

Statistics

Views

Total Views
13,813
Views on SlideShare
4,782
Embed Views
9,031

Actions

Likes
12
Downloads
92
Comments
0

17 Embeds 9,031

http://railstips.org 6758
http://www.railstips.org 1365
http://www.yy42.net 564
http://axonflux.com 303
http://www.slideshare.net 16
http://posterous.com 6
http://translate.googleusercontent.com 4
http://www.endorfine.od.ua 4
http://endorfine.od.ua 2
http://cache.baidu.com 2
http://74.125.93.132 1
http://203.208.39.132 1
http://arv.posterous.com 1
http://static.slidesharecdn.com 1
http://webcache.googleusercontent.com 1
https://webvpn.tuwien.ac.at 1
http://www.google.com.hk 1
More...

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
  • <br />
  • <br />
  • High volume, lower value. No transactions. Drivers for several languages. All network based for speed (instead of REST). <br /> Uses BSON for storage of objects and for building queries. Binary-encoded serialization like JSON. Allows for some representations that JSON does not. <br /> BSON seems “blob-like” but mongo speaks BSON and can “reach in” to documents. <br /> Powerful query language, with query optimizer. You can drop down to javascript also. <br /> Supports master/slave. <br /> <br />
  • Talk about harmony and how we are abusing mysql for key/value meta data on pages. <br /> Talk about capped collections and how they work like memcache. Also, how they are used for replication even. <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • _id’s can be any type, just have to be unique in collection <br />
  • find always returns a cursor that you can keep iterating through <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • Don’t have to typecast with mongo as it “knows” types but form submissions are always strings so typecasting has its benefits. <br /> * note required <br /> * note length <br /> * note numeric <br /> * note index <br />
  • multikey - automatically index arrays of object values <br /> ensure index on tags or _keywords <br />
  • <br />

MongoDB Grand Rapids RUG Presentation Transcript

  • 1. INTRO
  • 2. INTRO • Built For Speed • Document/Collection Oriented • Dynamic Queries and Indexes • Replication and Failover
  • 3. GREAT FOR • Websites • Caching • High volume, low value • High scalability • Storage of program objects and json
  • 4. NOT AS GREAT FOR • Highly transactional • Ad-hoc business intelligence • Problems requiring SQL
  • 5. INSTALLATION • mkdir -p /data/db • download pre-built for OSX and unzip to /usr/local/ • cp -R /usr/local/pathtomongo/bin /usr/local/bin
  • 6. DATABASE • same concept as mysql • made up of collections
  • 7. COLLECTION • Think table, but with no schema • For grouping documents into smaller query sets (speed) • Eachtop level entity in your app would have its own collection (users, articles, etc.) • Indexable by one or more key
  • 8. DOCUMENT • Stored in a collection, think record or row • Can have _id key that works like primary keys in MySQL • Two options for relationships: subdocument or db reference
  • 9. QUERYING • db.collection.find({‘first_name’: ‘John’}) # finds all Johns • db.collection.find({‘first_name’: /^J/}) # regex • db.collection.find_first({‘_id’:1}) # finds first with _id of 1 • db.collection.find({‘age’: {‘$gt’: 21}}) # finds possible drinkers • db.collection.find({‘author.first_name’:‘John’}) # subdocument • db.collection.find({$where:‘this.age >= 6 && this.age <= 18’})
  • 10. MORE QUERYING • $in, $nin, $all, $ne, $gt, $gte, $lt, $lte, $size, $where • :fields (like :select in active record) • :limit, :offset for pagination • :sort ascending or descending [[‘foo’, 1], [‘bar’, -1]] • count and group (uses map/reduce)
  • 11. HOW DO YOU USE IT WITH RUBY • mongo-ruby-driver http://github.com/mongodb/mongo-ruby- driver • activerecord adapter http://github.com/mongodb/ activerecord-mongo-adapter • mongorecord http://github.com/mongodb/mongo- activerecord-ruby
  • 12. NUNEMAPPER (MONGOMAPPER) • Mongo is not MySQL • DSL for modeling domain should also teach you Mongo • It sounded fun • Almost finished and sitting in private GitHub repo
  • 13. FEATURES • Typecasting • Create and Update with single or multiple • Callbacks(ActiveSupport Callbacks) • Delete and Destroy and _all counterparts • Validations (using my fork of validatable) • Find: id, ids, :all, :first, :last • Connection and database • Associations (incomplete) can differ per document
  • 14. EXAMPLE class User include MongoMapper::Document key :name, String, :required => true, :length => 5..100 key :email, String, :required => true, :index => true key :age, Integer, :numeric => true key :active, Boolean, :default => true one :address many :articles end class Address include MongoMapper::EmbeddedDocument key :street, String key :city, String key :state, String, :length => 2 key :zip, Integer, :numeric => true, :length => 5 end
  • 15. RANDOM AWESOMENESS • Capped collections (think memcache, actually used for replication) • Upserts db.collection.update({‘_id’:1}, {‘$inc’:{‘views’:1}}) • Multikeys (think tagging and full text search) • GridFS and auto-sharding
  • 16. John Nunemaker http://orderedlist.com http://railstips.org Links http://www.10gen.com http://mongodb.com