Open source, high performance Document-oriented database
• Introduction to MongoDB • MongoDB Rationale • MongoDB Relative to RDBMS • MongoDB- Schemaless • Web Application Framework with MongoDB • JSON • Introduction to Mongo Shell • CRUD • Further Readings Agenda
General Purpose Introduction to MongoDB Easy to Use Fast & Scalable Sophisticated query language Full featured indexes Rich data model Simple to setup and manage Native language drivers in all popular languages Easy mapping to object oriented code Dynamically add / remove capacity with no downtime Auto-sharding built in Operates at in- memory speed wherever possible
• MongoDB was created to make it easy to code, scale, and manage databases. • In agile programming, the sprint cycles are usually 3-5 weeks long. • Adding new columns to same collection is easy and intuitive. Agile and Scalable
MongoDB is fast and scalable Better data locality Relational MongoDB In-Memory Caching Distributed Architecture Horizontal Scaling Replication/HA
• Scaling horizontally (scale out) over commodity hardware is cheaper • RDBMS best features should be support: – Ad hoc queries – Fully featured indexes – Secondary indexes • Avoid things which does not scale well horizontally: – Long running multi-row transactions – Joins • Schema less design: – support for heterogeneous data within same collection – No more configuring database columns with types • Make web programming simpler and more productive by support of APIs. MongoDB Rationale
• Collection vs table • Document vs row • Field vs column • schema-less vs schema-oriented • Embedded documents, linking vs Joins MongoDB Relative to RDBMS
Features MySQL MongoDB Rich Data Model No Yes Dynamic Schema No Yes Typed Data Yes Yes Data Locality No Yes Field Updates Yes Yes Easy for Programmers No Yes Complex Transactions Yes No Auditing Yes Yes Auto-Sharding No Yes MySQL vs MongoDB
• MongoDB does not need any pre-defined data schema • Every document could have different data! MongoDB- Schema less name: “Kartik”, color: “Red”, loc: [40.7, 73.4], Hobbies: “cycling”} {name: “Avinash”, aliases: [“Avi”]} name: “Ram”, HasHat: ”yes”} {name: “Manish”, Food: “Pasta”, height: 172, loc: [44.6, 71.3]} {name: “Rajesh, color: “blue”, birthplace: “NY”, aliases: [“Raj”, “limbo”], loc: [32.7, 63.4]}
Web Application Framework with MongDB MongoDB Mongod process Mongo Shell JavaScript Interpreter TCP/IP Java App Code MVC MongoDB Java Driver JVM User Request Rest API TCP/IP Json
• JSON (JavaScript Object Notation) is a lightweight data- interchange format. • It is easy for humans to read and write. • It is easy for machines to parse and generate. • It is based on a subset of the JavaScript Programming Language. • JSON is a text format that is completely language independent but uses conventions that are familiar to programmers of the C-family of languages, including C, C++, C#, Java, JavaScript, Perl, Python, and many others. • These properties make JSON an ideal data-interchange language. JSON
• Quick Demo on use to Mongo Shell • Demonstration of how to start the Mongod process • Connecting to MongoDB via mongo • Basics commands Introduction to Mongo Shell
• db.collection.insert() • db.collection.find()/ db.collection.findOne() • db.collection.update({string:value},{$set:{string:value}}) • db.collection.remove() CRUD
• MongoDB is open source and there is no cost to download and use it.  • MongoDB is a general purpose database that is used for a variety of use cases. The most common use cases for MongoDB include: – Single View, – Internet of Things, – Mobile, – Real-Time Analytics, – Catalog, and – Content Management. • https://university.mongodb.com/ • http://docs.mongodb.org/manual/reference/sql- comparison/ • http://docs.mongodb.org/manual/reference/sql- aggregation-comparison/ Further Readings

mongodb_Introduction

  • 1.
    Open source, highperformance Document-oriented database
  • 2.
    • Introduction toMongoDB • MongoDB Rationale • MongoDB Relative to RDBMS • MongoDB- Schemaless • Web Application Framework with MongoDB • JSON • Introduction to Mongo Shell • CRUD • Further Readings Agenda
  • 3.
    General Purpose Introduction to MongoDB Easyto Use Fast & Scalable Sophisticated query language Full featured indexes Rich data model Simple to setup and manage Native language drivers in all popular languages Easy mapping to object oriented code Dynamically add / remove capacity with no downtime Auto-sharding built in Operates at in- memory speed wherever possible
  • 4.
    • MongoDB wascreated to make it easy to code, scale, and manage databases. • In agile programming, the sprint cycles are usually 3-5 weeks long. • Adding new columns to same collection is easy and intuitive. Agile and Scalable
  • 5.
    MongoDB is fastand scalable Better data locality Relational MongoDB In-Memory Caching Distributed Architecture Horizontal Scaling Replication/HA
  • 6.
    • Scaling horizontally(scale out) over commodity hardware is cheaper • RDBMS best features should be support: – Ad hoc queries – Fully featured indexes – Secondary indexes • Avoid things which does not scale well horizontally: – Long running multi-row transactions – Joins • Schema less design: – support for heterogeneous data within same collection – No more configuring database columns with types • Make web programming simpler and more productive by support of APIs. MongoDB Rationale
  • 7.
    • Collection vstable • Document vs row • Field vs column • schema-less vs schema-oriented • Embedded documents, linking vs Joins MongoDB Relative to RDBMS
  • 8.
    Features MySQL MongoDB RichData Model No Yes Dynamic Schema No Yes Typed Data Yes Yes Data Locality No Yes Field Updates Yes Yes Easy for Programmers No Yes Complex Transactions Yes No Auditing Yes Yes Auto-Sharding No Yes MySQL vs MongoDB
  • 9.
    • MongoDB doesnot need any pre-defined data schema • Every document could have different data! MongoDB- Schema less name: “Kartik”, color: “Red”, loc: [40.7, 73.4], Hobbies: “cycling”} {name: “Avinash”, aliases: [“Avi”]} name: “Ram”, HasHat: ”yes”} {name: “Manish”, Food: “Pasta”, height: 172, loc: [44.6, 71.3]} {name: “Rajesh, color: “blue”, birthplace: “NY”, aliases: [“Raj”, “limbo”], loc: [32.7, 63.4]}
  • 10.
    Web Application Frameworkwith MongDB MongoDB Mongod process Mongo Shell JavaScript Interpreter TCP/IP Java App Code MVC MongoDB Java Driver JVM User Request Rest API TCP/IP Json
  • 11.
    • JSON (JavaScriptObject Notation) is a lightweight data- interchange format. • It is easy for humans to read and write. • It is easy for machines to parse and generate. • It is based on a subset of the JavaScript Programming Language. • JSON is a text format that is completely language independent but uses conventions that are familiar to programmers of the C-family of languages, including C, C++, C#, Java, JavaScript, Perl, Python, and many others. • These properties make JSON an ideal data-interchange language. JSON
  • 12.
    • Quick Demoon use to Mongo Shell • Demonstration of how to start the Mongod process • Connecting to MongoDB via mongo • Basics commands Introduction to Mongo Shell
  • 13.
    • db.collection.insert() • db.collection.find()/db.collection.findOne() • db.collection.update({string:value},{$set:{string:value}}) • db.collection.remove() CRUD
  • 14.
    • MongoDB isopen source and there is no cost to download and use it.  • MongoDB is a general purpose database that is used for a variety of use cases. The most common use cases for MongoDB include: – Single View, – Internet of Things, – Mobile, – Real-Time Analytics, – Catalog, and – Content Management. • https://university.mongodb.com/ • http://docs.mongodb.org/manual/reference/sql- comparison/ • http://docs.mongodb.org/manual/reference/sql- aggregation-comparison/ Further Readings

Editor's Notes

  • #10 Applications enforce the data “schema” and integrity, much like MUMPS does in VistA