Jan 15, 2015
WHOAMI
WOUTER IBENS
25 years old
MSc Computer Science
Work @ Kangaroot → Linux & Open Source Solutions
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, ...
Mapping complex data is more intuitive
Freedom of datafields
Freedom of datatypes
Features come at a cost
DOCUMENT STORE VS SQL
mongoDB
Development started: October 2007
Initial release: 2009
JavaScript backend and shell
Data: JSON variant BSON
DB-ENGINES RANKING OF mongoDB
{ "_id": ObjectId("5321b44c399f2131d4b87e06"), "firstname": "Wouter", "lastname": "ibens", "age": 25, "hobbies": [ "SCUBA Diving", "Pathfinder" ], "favfood": { "name": "pizza", "toppings": [ "mushrooms", "olives", "feta" ] }, "boss": ObjectId("507f1f77bcf86cd799439011")}
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
FEATURES
Replication
Sharding
GridFS
Capped collections
TTL
Server side JavaScript
REPLICATION
SHARDING
GridFS
Capped collections
TTL
Remote Javascript
OTHER FEATURES
THANK YOU
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/