iFour Consultancy MongoDB Introduction, Installation & Execution https://www.ifourtechnolab.com
 Scalable High-Performance Open-source, Document-orientated database.  Built for Speed  Rich Document based queries for Easy readability.  Full Index Support for High Performance.  Replication and Failover for High Availability.  Auto Sharding for Easy Scalability.  Map / Reduce for Aggregation. What is MongoDB ? https://www.ifourtechnolab.com
 SQL was invented in the 70’s to store data.  MongoDB stores documents (or) objects.  Now-a-days, everyone works with objects (Python/Ruby/Java/etc.)  And we need Databases to persist our objects. Then why not store objects directly ?  Embedded documents and arrays reduce need for joins. No Joins and No-multi document transactions. Why use MongoDB? https://www.ifourtechnolab.com
 RDBMS replacement for Web Applications.  Semi-structured Content Management.  Real-time Analytics & High-Speed Logging.  Caching and High Scalability  Web 2.0, Media, SAAS, Gaming  HealthCare, Finance, Telecom, Government What is MongoDB great for? https://www.ifourtechnolab.com
 Highly Transactional Applications.  Problems requiring SQL. Not great for? Some Companies using MongoDB in Production https://www.ifourtechnolab.com
Advantages of MongoDB Schema less : Number of fields, content and size of the document can be differ from one document to another. No complex joins Data is stored as JSON style Index on any attribute Replication and High availability https://www.ifourtechnolab.com
7 MongoDB Terminologies for RDBMS concepts RDBMS MongoDB Database Database Table, View Collection Row Document (JSON, BSON) Column Field Index Index Join Embedded Document Foreign Key Reference Partition Shard https://www.ifourtechnolab.com
JSON “JavaScript Object Notation” Easy for humans to write/read, easy for computers to parse/generate Objects can be nested Built on • name/value pairs • Ordered list of values http://json.org/ https://www.ifourtechnolab.com
BSON “Binary JSON” Binary-encoded serialization of JSON-like docs Embedded structure reduces need for joins Goals • Lightweight • Traversable • Efficient (decoding and encoding) http://bsonspec.org/ https://www.ifourtechnolab.com
BSON Example { "_id" : "37010" “City" : “Nashik", “Pin" : 423201, "state" : “MH", “Postman” : { name: “Ramesh Jadhav” address: “Panchavati” } } https://www.ifourtechnolab.com
Integer Boolean Double String ArraysNull Object ID Binary data Date Data Types of MongoDB https://www.ifourtechnolab.com
 String : This is most commonly used datatype to store the data. String in mongodb must be UTF-8 valid.  Integer : This type is used to store a numerical value. Integer can be 32 bit or 64 bit depending upon your server.  Boolean : This type is used to store a boolean (true/ false) value.  Double : This type is used to store floating point values.  Min/ Max keys : This type is used to compare a value against the lowest and highest BSON elements.  Arrays : This type is used to store arrays or list or multiple values into one key.  Timestamp : ctimestamp. This can be handy for recording when a document has been modified or added.  Object : This datatype is used for embedded documents. Data Types https://www.ifourtechnolab.com
 Null : This type is used to store a Null value.  Symbol : This datatype is used identically to a string however, it's generally reserved for languages that use a specific symbol type.  Date : This datatype is used to store the current date or time in UNIX time format. You can specify your own date time by creating object of Date and passing day, month, year into it.  Object ID : This datatype is used to store the document’s ID.  Binary data : This datatype is used to store binay data.  Code : This datatype is used to store javascript code into document.  Regular expression : This datatype is used to store regular expression Data Types https://www.ifourtechnolab.com
Installation in Windows  Download MongoDB from Website: https://www.mongodb.org/downloads  Select option Windows  Download and Run https://www.ifourtechnolab.com
Create one folder (eg SNJB) in bin folder of MongoDB Goto command prompt Goto bin dir of MongoDB and write following command mongod --storageEngine=mmapv1 --dbpath SNJB (Server will started and listen at 27017 port) Open another command prompt and give command mongo (Client will be started) Starting MongoDB in Windows https://www.ifourtechnolab.com
Installation in Ubuntu  Download MongoDB from Website: https://www.mongodb.org/downloads  Select option Linux  Download and Run https://www.ifourtechnolab.com
Starting MongoDB in Ubuntu Create a folder in bin directory of mongodb Open terminal Goto mongodb bin folder (cd mongo….) Type ./mongod (Server is started) Open another terminal Goto mongodb bin folder (cd mongo….) Type ./mongo (client will be started) Run all commands on client terminal https://www.ifourtechnolab.com
Outline Difference Between SQL and NoSQL Study of Open Source NOSQL Database MongoDB Installation, Basic CRUD operations, Execution https://www.ifourtechnolab.com
Database collection Basic Database Operations https://www.ifourtechnolab.com
• switched to database provided with ciommand use <database name> • To check currently selected database use the command dbdb • Displays the list of databasesshow dbs • To Drop the database db.dropDatabase () Basic Database Operations- Database https://www.ifourtechnolab.com
• To create collection db.createCollection (name) Ex:- db.createCollection(Stud) • List out all names of collection in current database>show collections • In mongodb you don't need to create collection. MongoDB creates collection automatically, when you insert some document. db.databasename.insert ({Key : Value}) Ex:- db.Stud.insert({{Name:”Jiya”}) • MongoDB's db.collection.drop() is used to drop a collection from the database. db.collection.drop() Example:- db.Stud.drop() Basic Database Operations- Collection https://www.ifourtechnolab.com

MongoDB Introduction, Installation & Execution

  • 1.
    iFour Consultancy MongoDB Introduction, Installation& Execution https://www.ifourtechnolab.com
  • 2.
     Scalable High-PerformanceOpen-source, Document-orientated database.  Built for Speed  Rich Document based queries for Easy readability.  Full Index Support for High Performance.  Replication and Failover for High Availability.  Auto Sharding for Easy Scalability.  Map / Reduce for Aggregation. What is MongoDB ? https://www.ifourtechnolab.com
  • 3.
     SQL wasinvented in the 70’s to store data.  MongoDB stores documents (or) objects.  Now-a-days, everyone works with objects (Python/Ruby/Java/etc.)  And we need Databases to persist our objects. Then why not store objects directly ?  Embedded documents and arrays reduce need for joins. No Joins and No-multi document transactions. Why use MongoDB? https://www.ifourtechnolab.com
  • 4.
     RDBMS replacementfor Web Applications.  Semi-structured Content Management.  Real-time Analytics & High-Speed Logging.  Caching and High Scalability  Web 2.0, Media, SAAS, Gaming  HealthCare, Finance, Telecom, Government What is MongoDB great for? https://www.ifourtechnolab.com
  • 5.
     Highly TransactionalApplications.  Problems requiring SQL. Not great for? Some Companies using MongoDB in Production https://www.ifourtechnolab.com
  • 6.
    Advantages of MongoDB Schemaless : Number of fields, content and size of the document can be differ from one document to another. No complex joins Data is stored as JSON style Index on any attribute Replication and High availability https://www.ifourtechnolab.com
  • 7.
    7 MongoDB Terminologies forRDBMS concepts RDBMS MongoDB Database Database Table, View Collection Row Document (JSON, BSON) Column Field Index Index Join Embedded Document Foreign Key Reference Partition Shard https://www.ifourtechnolab.com
  • 8.
    JSON “JavaScript Object Notation” Easyfor humans to write/read, easy for computers to parse/generate Objects can be nested Built on • name/value pairs • Ordered list of values http://json.org/ https://www.ifourtechnolab.com
  • 9.
    BSON “Binary JSON” Binary-encoded serializationof JSON-like docs Embedded structure reduces need for joins Goals • Lightweight • Traversable • Efficient (decoding and encoding) http://bsonspec.org/ https://www.ifourtechnolab.com
  • 10.
    BSON Example { "_id" :"37010" “City" : “Nashik", “Pin" : 423201, "state" : “MH", “Postman” : { name: “Ramesh Jadhav” address: “Panchavati” } } https://www.ifourtechnolab.com
  • 11.
    Integer Boolean Double String ArraysNull Object ID Binary data Date DataTypes of MongoDB https://www.ifourtechnolab.com
  • 12.
     String :This is most commonly used datatype to store the data. String in mongodb must be UTF-8 valid.  Integer : This type is used to store a numerical value. Integer can be 32 bit or 64 bit depending upon your server.  Boolean : This type is used to store a boolean (true/ false) value.  Double : This type is used to store floating point values.  Min/ Max keys : This type is used to compare a value against the lowest and highest BSON elements.  Arrays : This type is used to store arrays or list or multiple values into one key.  Timestamp : ctimestamp. This can be handy for recording when a document has been modified or added.  Object : This datatype is used for embedded documents. Data Types https://www.ifourtechnolab.com
  • 13.
     Null :This type is used to store a Null value.  Symbol : This datatype is used identically to a string however, it's generally reserved for languages that use a specific symbol type.  Date : This datatype is used to store the current date or time in UNIX time format. You can specify your own date time by creating object of Date and passing day, month, year into it.  Object ID : This datatype is used to store the document’s ID.  Binary data : This datatype is used to store binay data.  Code : This datatype is used to store javascript code into document.  Regular expression : This datatype is used to store regular expression Data Types https://www.ifourtechnolab.com
  • 14.
    Installation in Windows Download MongoDB from Website: https://www.mongodb.org/downloads  Select option Windows  Download and Run https://www.ifourtechnolab.com
  • 15.
    Create one folder(eg SNJB) in bin folder of MongoDB Goto command prompt Goto bin dir of MongoDB and write following command mongod --storageEngine=mmapv1 --dbpath SNJB (Server will started and listen at 27017 port) Open another command prompt and give command mongo (Client will be started) Starting MongoDB in Windows https://www.ifourtechnolab.com
  • 16.
    Installation in Ubuntu Download MongoDB from Website: https://www.mongodb.org/downloads  Select option Linux  Download and Run https://www.ifourtechnolab.com
  • 17.
    Starting MongoDB inUbuntu Create a folder in bin directory of mongodb Open terminal Goto mongodb bin folder (cd mongo….) Type ./mongod (Server is started) Open another terminal Goto mongodb bin folder (cd mongo….) Type ./mongo (client will be started) Run all commands on client terminal https://www.ifourtechnolab.com
  • 18.
    Outline Difference Between SQLand NoSQL Study of Open Source NOSQL Database MongoDB Installation, Basic CRUD operations, Execution https://www.ifourtechnolab.com
  • 19.
  • 20.
    • switched todatabase provided with ciommand use <database name> • To check currently selected database use the command dbdb • Displays the list of databasesshow dbs • To Drop the database db.dropDatabase () Basic Database Operations- Database https://www.ifourtechnolab.com
  • 21.
    • To createcollection db.createCollection (name) Ex:- db.createCollection(Stud) • List out all names of collection in current database>show collections • In mongodb you don't need to create collection. MongoDB creates collection automatically, when you insert some document. db.databasename.insert ({Key : Value}) Ex:- db.Stud.insert({{Name:”Jiya”}) • MongoDB's db.collection.drop() is used to drop a collection from the database. db.collection.drop() Example:- db.Stud.drop() Basic Database Operations- Collection https://www.ifourtechnolab.com

Editor's Notes

  • #2 Software Outsourcing Company India - http://www.ifourtechnolab.com/
  • #8 Javascript