mongodb in simple and easy steps
TRANSCRIPT
Agenda
What is MongoDB?
What is NOSQL?
RDBMS Vs NOSQL
Scalability
Sharding
Installation MongoDB, Startup/Shutdown
JSON
Data Modeling
CRUD
Indexing
Backup/Restore
MongoDB?
MongoDB is a Non-Relational, Document Oriented, High Available, High Scalable, Schema-less, BSON formatted supported, Sharding supported, Open Source, NoSQL database.
It won’t support Joins and SQLs.
MongoDB named from humongous, meaning is extremely large.
Startup/Shutdown
Mongod - server startup
Mongo - client connection
Exit - shut-down
Mongod –version
Mongod –help
Startup/Shutdown
mongod --dbpath c:\mongodb\data
journal - redo directory, flash recovery
ns - namespace - system catalog
mongo --nodb
2+(3*6)
x={name:'sasi',age:32}
x.name
x.age
JSON Formats:
{ }
{
id:123,
name:'jk‘
}
{
id:123,
name:'jk',
hobbies:['cricket','movies']
}
{
id:123,
name:'jk',
hobbies:['cricket','movies'],
address:{add1:'line1',add2:'street1',city:'hyd'}
}
Data Modeling
Mongo can host a no/of Databases.
A Database holds a set of Collections.
A Collection holds a set of Documents.
A Document is a set of Key-Value pair.
A Document is a Dynamic Schema.
MongoDB is a JavaScript interpretor.
javascript ex:
for ( i=0; i<5; i++) print("Welcome to MongoDB");
MongoDB stores data in BSON format
- BSON is in serialized format
CRUD Operations
SQL Mongo
Create Insert Insert
Read Select Find
Update Update Update
Delete Delete Remove
crud_demo
Indexing
Indexes provide high performance read
operations for frequently used queries.
indexing_demo
Backup Utilities
mongodump - take the dump of the database instance, it will store
dump in bson format.
mongorestore - restore the dump of the database instance, it will restore
bson dump only.
bsondump - the bsondump converts BSON files into human-readable
formats.
mongoexport - mongoexport is a utility that produces a JSON or CSV
export of data stored in a MongoDB instance
mongoimport - The mongoimport tool provides a route to import
content from a JSON, CSV, or TSV export created by mongoexport
backupUtility_demo