Friday, February 26, 2010

OCRuby Feb 26, 2000 meeting minutes

Thought I'd post this here since the OCRuby group submission is moderated.

This is mainly interesting for the Mongo DB presentation by Tommy Chheng.


Michael Hartl
Tommy Chheng
Scott Smith

Michael has published 7 chapters of his electronic book at

Tommy: Whither Mongo DB for Natural Development

Used by:
  • github
  • EA
  • The New York Times
  • sourceforge
  • The Business Insider
The above are "big" sites.

  • NoSQL trend?
  • Scalability?
  • Natural Development!

SQL fixed schema
  • Data model Rows/Tables
  • Data Types Primitives
MongoDB Dynamic
  • BSON Documents/Collections
  • Primitives+Arrays/Hashes
Records vs Documents

3 tables
  • Documents
  • Revisions
  • Tags
  • document = {title:...} (reads as Javascript code)
  • BSON data structure naturally maps to most programming languages hash object.
  • ORM can just be a thin layer.
  • Can debug Mongo a lot easier.
Mongo Install

How to use in Ruby?

Easy to use in Rails or Sinatra
2 gems
  • mongo+mongo_ext gem
  • mongo_mapper gem

MongoMapper Models
  • No Migrations!
  • AR Validations
  • AR Callbacks
  • Testing using Facory Girl
  • Rails 3?
    • fork which uses ActiveModel, see mailinglist
    • is complete but not merged in yet.

MongoMapper Model

(sample code)

CouchDB or MongoDB?

  • One big database
  • Find by id ma/reduce JS functions
  • MVCC
  • Many collections
  • sockets
  • Find by id - dynamic JS queries
  • Update in place
MVCC - updates by making new version copy; good for data safety.
Update in place is a lot faster

MongoDB by default writes to disk in batches


Memory Mapped file:
  • 32-bit 4GB limit, use 64-bit
Atomic updates only at document level
  • Solve by nesting related data in document
MongoDB lacks:
  • transactions
  • CouchDB-style MVCC revisioning


Twitter @tommychheng
  • using mongoDB + mongo_mapper!

No comments:

Post a Comment