http://rockalabs.com
xergioalex
SQL (1979)
Optimize the storage cost
Rows Stores (RDBMS)
* Store data aligned by rows
* Reads retrieve a complete row every time
Why NoSQL
The world has Changed
Google and Amazon develop new systems to storage data.
* Distributed systems
* Open Source
* Non relational
* Key/Value Stores
* Column Stores
* Multi-model Databases (Combine relational + non relational DBs)
* Document Stores
* Graph Stores
$ echo "deb http://repo.mongodb.org/apt/ubuntu trusty/mongodb-org/3.2 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.2.list
Ubuntu
$ sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv EA312927
$ sudo apt-get update
$ sudo apt-get install -y mongodb-org
Core Processes
* Mongod
* Mongos
* Mongo
Binary Import and Export Tools
* Bsondump
Data Import and Export Tools
Diagnostic Tools
GridFS
$ mongo
$ show databases
$ use rockalabs
$ db.users.insert({ nombre: "Sergio", apellido: "Florez")
$ db.users.findOne()
$ db.users.find()
$ db.users.find().pretty()
$ db.users.createIndex({ nombre: 1 })
$ show collections
$ db.users.dropIndex({ "username": 1 })
$ db.users.getIndexes()
$ mongostats
* COLLSCAN: for a collection scan
* IXSCAN: for scanning index keys
* FETCH: for retrieving documents
* SHARD_MERGE: for merging results from shards
$ db.users.find().explain()
$ db.users.find({ nombre: "Sergio" }).explain("executionStats")
Visually explore your data
Visually explore your data
Packages to use:
* mongodb
* faker
* mongoose
Resources
* Basic concepts about MongoDB (Talks)
http://rockalabs.com
xergioalex