9. The problems with RDBMS
Good at space storage at the cost of
● schema design
● data lookup and complex queries
● saving data needs coordination between
many tables
10. Disruption in DB - for the BIG users, data,
and the cloud
Source: http://www.mindfiresolutions.com/blog/wp-content/uploads/nosql-plm.png
11. NoSql DB
● Efficient data queries
● Handle large volumes of structured, and unstructured
data -- with relative ease
● Simple design
● Easy horizontal elastic scaling
● High performance because of lock free architecture
● Good bye DBAs
14. Databases
● With an mongodb instance, there can be
many databases (high-level containers)
● each database can have zero or more
collections
15. Collections
● Containers for documents that share one or
more indexes
● Equivalent of RDBMS table
● No schema and can have different fields
● Exists within a single DB
● Contains zero or more documents
16. Document
● Designed with notion of “Document”. Some
standard encoding like: XML, JSON, BSON,
YAML, other binary formats (pdf, word, excel, etc)
● Document is kind of record, limited to 16 MB
size
● Contains one or more fields (kind of
columns, since fields are document level)
17. Recap
● MongoDB is made up of databases which contain
collections.
● A collection is made up of documents.
● Each document is made up of fields.
● Collections can be indexed, which improves lookup and
sorting performance.
● When we get data from MongoDB we do so through a
cursor whose actual execution is delayed until
necessary
18. RDBMS equivalent
RDBMS MongoDB
Database Database
Table/View Collection
Row/Record JSON Document stored as BSON
Index Index
Join Embedded Document
Foreign Key Reference
Partition Shard
19. MongoDB stores in BSON
Simple JSON data (stored in BSON):
{
"id": 1,
"jsonrpc": "2.0",
"method": "subtract",
"params": [42, 23]
}
21. Installation and Setup
1. Download from http://www.mongodb.org/downloads
2. Create a data directory, where you want the
data to be stored: mkdir data
3. Start mongodb server:
<installed path>/bin/mongod --dbpath=data
4. Access http://localhost:28017 (if mongod
running with default port on the local machine)