12

Click here to load reader

MongoDB 101

Embed Size (px)

DESCRIPTION

MongoDB introduction for a bunch of startup guys

Citation preview

Page 1: MongoDB 101

MongoDB 101Just enough to start playing

Page 2: MongoDB 101

What is it anyway ?● Document Oriented● High performance● Highly available● Horizontally Scalable● Open Source● NoSQL database

Page 3: MongoDB 101

Data model - Document Oriented● Documents (objects) map nicely to

programming language data types.○ Document = PHP array, ruby hash, python dictionary

● Embedded documents and arrays reduce need for joins.

● Dynamic schema makes polymorphism easier.

● JSON-style, stored as BSON

Page 4: MongoDB 101

High Performance● Written in C++● use of memory mapped files● Serialization in BSON for fast parsing● Embedding● Indexes can include keys from embedded

documents and arrays.● Optional streaming writes (no

acknowledgments).

Page 5: MongoDB 101

NoSql - why should I care ?● Data has changed - unstructured data

Dynamic schemas

● Performance○ Auto sharding○ replication○ distributed, but integrated cache

● Depends on what is your data○ Key-value○ column oriented ○ graph

Page 6: MongoDB 101

● Horizontal vs Vertical● More data needs more machines, not bigger

machines● Simplicity less ops when things grow

Scalable

Page 7: MongoDB 101

Why not anything else ?● Built with developers in mind, not ops● Available on all platforms - client library

bindings available for almost all languages (Erlang, Haskell, lua, smalltalk, prolog,..)

● 10gen and great community behind● Near to RDBMS in NoSQL landscape.

Similar to MyISAM storage engine for mysql● MongoDB does have support for atomic

operations within a single document.

Page 8: MongoDB 101

RDBMS refugees

DB server mysqld mongod

DB client mysql mongo

Highest storage unit database database

Logical data table collection

row row document

column column field

Join Join Embedded Doc

Distribute partition shard

Page 9: MongoDB 101

Hybrid RDBMS-MongoDB Applications● Both has its own advantages● Use right tool for right job● We do need transections, joins and RDBMS● Not as complicated as you might think !!● Think mongodb collections as extended

tables from your RDBMS.

Page 10: MongoDB 101

● GridFS● MapReduce support● Sharded and Replica deployment● Aggregation● Indexing● Rest interface● ops - monitoring,backup,security● geo-spatial features● and ... lot more...

A lot of other cool stuff

Page 11: MongoDB 101

References● http://www.mongodb.org

● http://www.10gen.com/presentations

● MongoDB- The Definitive Guide

● Tips & Tricks for mongoDB developers

Page 12: MongoDB 101

Thanks !!

@dharmeshkakadia