Introduction to mongoDB

15

description

Relational database management systems exist since the seventies. Since then they have increased in popularity and usage. Lots of (Internet) applications make use of a database system. Most of the time this is a SQL database. Its table structure is intuitive to understand and links are made using key columns. MongoDB is a relatively new, but increasingly popular database system. It builds on the adoption of NoSQL database systems and uses a variant to the new but quickly emerged JSON format for storing its data. In this presentation I will not only give an insight in the pros and contras of NoSQL in general, but I will also give a brief introduction of the various features of MongoDB.

Transcript of Introduction to mongoDB

Page 1: Introduction to mongoDB
Page 2: Introduction to mongoDB

WHOAMI

WOUTER IBENS

25 years old

MSc Computer Science

Work @ Kangaroot → Linux & Open Source Solutions

[email protected]

Page 3: Introduction to mongoDB

INTRODUCTION TO mongoDB

Page 4: Introduction to mongoDB

SQL

Databases contain tables

Tables contain rows

Rows contain data:

The columns of the table

Examples:

MySQL, MS SQL, PostgreSQL,

SQLite, ...

(NO)SQL

DOCUMENT STORE

Databases contain collections

Collections contain records

Records contain data:

The fields of the record

Examples:

MongoDB, CouchDB, ...

Page 5: Introduction to mongoDB

Mapping complex data is more intuitive

Freedom of datafields

Freedom of datatypes

Features come at a cost

DOCUMENT STORE VS SQL

Page 6: Introduction to mongoDB

mongoDB

Development started: October 2007

Initial release: 2009

JavaScript backend and shell

Data: JSON variant BSON

Page 7: Introduction to mongoDB

DB-ENGINES RANKING OF mongoDB

Page 8: Introduction to mongoDB

{    "_id": ObjectId("5321b44c399f2131d4b87e06"),    "firstname": "Wouter",    "lastname": "ibens",    "age": 25,    "hobbies": [        "SCUBA Diving",        "Pathfinder"    ],    "favfood": {        "name": "pizza",        "toppings": [            "mushrooms",            "olives",            "feta"        ]    },    "boss": ObjectId("507f1f77bcf86cd799439011")}

Page 9: Introduction to mongoDB

db.coll.insert(record)

db.coll.find(query)[.skip(5)][.limit(5)]db.coll.findOne(query)

db.coll.remove(query[, justone=false])

db.coll.update(query, record)db.coll.update(query, $set: {changes})

db.coll.update(query, record,{upsert: true, multi: true})

OPERATIONS

Page 10: Introduction to mongoDB

FEATURES

Replication

Sharding

GridFS

Capped collections

TTL

Server side JavaScript

Page 11: Introduction to mongoDB

REPLICATION

Page 12: Introduction to mongoDB

SHARDING

Page 13: Introduction to mongoDB

GridFS

Capped collections

TTL

Remote Javascript

OTHER FEATURES

Page 14: Introduction to mongoDB

THANK YOU

Page 15: Introduction to mongoDB

REFERENCES

http://slashdot.org/topic/bi/sql-vs-nosql-which-is-better/

http://askasya.com/post/why-shouldnt-i-embed-large-arrays-in-my-

documents

http://db-engines.com/en/ranking

http://docs.mongodb.org/manual/core/