Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Intro to MongoDB (Updated)

20spokes
October 24, 2012

Intro to MongoDB (Updated)

20spokes

October 24, 2012
Tweet

More Decks by 20spokes

Other Decks in Technology

Transcript

  1. Fancy Answer NoSQL is a class of database management system

    identified by its non-adherence to the widely-use relational database management system
  2. Does not use SQL as its query language May not

    give full ACID guarantees Distributed architecture Typically optimized for reading and writing operations
  3. NoSQl is Still Young Does not reduce administration (at least

    not yet) Lack of expertise Lack of projects expanding on NoSQL
  4. NoSQL out in the Wild Analytics - takes advantage of

    read/write optimizations Logging Large Scale Projects
  5. Document Oriented No schemas!! No joins for high performance and

    scalability embed documents JSON-Style storage
  6. High Performance Stores a lot of data in memory Embedding

    documents increase read and writes Allows indexing
  7. Availability and Scalability Replicated servers with automatic master failover Auto-sharing

    across servers Consistent reads distributed over replicated servers
  8. Atomic Modifers In place updating documents Does not replace entire

    document Ideally suited for write heavy applications
  9. Storing data Data is grouped by collections Collection contains documents

    of key-value pairs Values can be rich including arrays and documents Stored as BSON - Binary Serialized Document Notation
  10. Querying Javascript console allows for functions Returns a cursor -

    lazy load of results Queries expressed as JSON Documents auto-assigned ObjectId
  11. The big data loss debate Internet flame war history Mongo

    performs one write at a time - global lock Stored in memory Replication - fail over
  12. Embed vs Referenced Relationships for models Object Models - Think

    differently When in doubt store in different collection
  13. Mongoid Advantages Excellent Documentation Active Community Compatibility with other projects

    Similar API to ActiveRecord Uses ActiveValidation Version library
  14. Compatible Gems Devise - Authentication solutions for Rails Carrierwave -

    Simple and flexible way to upload files from Ruby. Supports GridFS Geocoder - Complete geocoding solution for Rails Mongoid-Rspec - RSpec matchers and macros for Mongoid
  15. Mongoid Document class Team include Mongoid::Document include Mongoid::Timestamps field :name,

    type: String field :city, type: String field :location, :type => Array validates :name, :city, :presence => true end