MongoDB By      Rony Abraham Gregory       Model Engineering College
What is MongoDB?•   Humongous (huge + monstrous)•   Document Database•   Schema free•   C++•   Open Source
What is MongoDB?• GNU AGPL v3.0 Licence• OSX, Linux, Windows, Solaris | 32  bit, 64 bit• Development and Support by 10gen ...
Database Paradigms• Relational (RDBMS)• NoSQL  oKey-value stores  oDocument databases  oWide column stores (BigTable and  ...
Relational Databases• ACID (Atomicity Consistency Isolation  and Durability)• SQL• MySQL, PostgreSQL, Oracle, etc.
Key-value stores• “One key, one value, no duplicates and  very fast”• It’s a Hash!• The value is a binary object aka “blob...
Key-value stores       Fig: A key-value store
Document databases• Key-value stores, but the value is  (usually) structured and “understood”  by the DB.• Querying data i...
Document databases     Fig: A document database
Why NoSQL?• Schema-free• Massive data stores• Scalability• Some services simpler to implement  than using RDBMS• Great fit...
Why NOT NoSQL?• RDBMSes and its tools are mature• NoSQL implementations are often in  their “alpha” state• Data consistenc...
RDBMS vs NoSQL• Strong consistency vs Eventual  consistency• Big dataset vs HUGE dataset• Scaling is possible vs Scaling i...
RDBMS vs NoSQL• Strong consistency vs Eventual  consistency• Big dataset vs HUGE dataset• Scaling is possible vs Scaling i...
RDBMS vs NoSQL• Strong consistency vs Eventual  consistency• Big dataset vs HUGE dataset• Scaling is possible vs Scaling i...
Features• Standard database stuff   • Indexing   • Replication/failover support
Features• Documents are stored in BSON (JSON)• BSON is a Binary serialization of JSON-  like objects• This is extremely po...
Features•   Schema-less; very flexible•   Auto-sharding (alpha)•   Makes for easy horizontal; scaling•   Map/Reduce
Features• Very, very fast• Super easy to install• Strong with major languages
Features: Querying• Rich, JavaScript based query syntax• Allows us to do deep, nested queriesdb.order.find( {shipping: { c...
Features: Official Drivers• .NET, Java, JavaScript, Ruby, Node.js, PH  P, Haskell, C/C++, Perl
Concepts: Document-Oriented• Think of “documents” as  objects/database records• Documents are basically just JSON in  bina...
Concepts: Document-Oriented
Concepts: Document-Oriented      Concept Mapping
Concepts: Cursors• Queries return “cursors” instead of  collections   • A cursor allows you to iterate through     the res...
Concepts: Cursors• The find() function returns a cursor  object
Basic Operations•   Insert•   Find•   Update•   Remove•   ensureIndex
Basic Operations• Insertdb.test.insert({hello:’world’});• Find   oEquivalent of Select * FROM test;
Basic Operations:Updatedb.test.update(<condition>,<operation>)
Basic Operations: Removedb.test.remove(<condition>)
Basic Operations: Indexing• Its usually a good idea to index  collections• How and which columns depend on  what is to be ...
MongoDB in action!
References• MongoDB home at http://www.mongodb.org• MongoDB - The Definitive Guide by Kristina  Chodorow and Dirolf• NoSQL...
Upcoming SlideShare
Loading in...5
×

MongoDB

2,124

Published on

A brief intro to MongDB.

Published in: Technology
0 Comments
2 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
2,124
On Slideshare
0
From Embeds
0
Number of Embeds
4
Actions
Shares
0
Downloads
128
Comments
0
Likes
2
Embeds 0
No embeds

No notes for slide

MongoDB

  1. 1. MongoDB By Rony Abraham Gregory Model Engineering College
  2. 2. What is MongoDB?• Humongous (huge + monstrous)• Document Database• Schema free• C++• Open Source
  3. 3. What is MongoDB?• GNU AGPL v3.0 Licence• OSX, Linux, Windows, Solaris | 32 bit, 64 bit• Development and Support by 10gen and was first released in February 2009• NoSQL!
  4. 4. Database Paradigms• Relational (RDBMS)• NoSQL oKey-value stores oDocument databases oWide column stores (BigTable and clones) oGraph databases
  5. 5. Relational Databases• ACID (Atomicity Consistency Isolation and Durability)• SQL• MySQL, PostgreSQL, Oracle, etc.
  6. 6. Key-value stores• “One key, one value, no duplicates and very fast”• It’s a Hash!• The value is a binary object aka “blob” – the DB doesn’t understand it and doesn’t want to understand it.• Amazon Dynamo, MemcacheDB, etc.
  7. 7. Key-value stores Fig: A key-value store
  8. 8. Document databases• Key-value stores, but the value is (usually) structured and “understood” by the DB.• Querying data is possible (by means other than just a key).• Amazon SimpleDB, CouchDB, MongoDB, Riak, e tc.
  9. 9. Document databases Fig: A document database
  10. 10. Why NoSQL?• Schema-free• Massive data stores• Scalability• Some services simpler to implement than using RDBMS• Great fit for many Web 2.0 applications
  11. 11. Why NOT NoSQL?• RDBMSes and its tools are mature• NoSQL implementations are often in their “alpha” state• Data consistency, transactions• “Don’t scale until you need it”
  12. 12. RDBMS vs NoSQL• Strong consistency vs Eventual consistency• Big dataset vs HUGE dataset• Scaling is possible vs Scaling is easy• Good availability vs Very high availability
  13. 13. RDBMS vs NoSQL• Strong consistency vs Eventual consistency• Big dataset vs HUGE dataset• Scaling is possible vs Scaling is easy• Good availability vs Very high availability
  14. 14. RDBMS vs NoSQL• Strong consistency vs Eventual consistency• Big dataset vs HUGE dataset• Scaling is possible vs Scaling is easy• Good availability vs Very high availability
  15. 15. Features• Standard database stuff • Indexing • Replication/failover support
  16. 16. Features• Documents are stored in BSON (JSON)• BSON is a Binary serialization of JSON- like objects• This is extremely powerful, because it means mongoDB understands JSON natively• Any valid JSON can be easily imported and queried
  17. 17. Features• Schema-less; very flexible• Auto-sharding (alpha)• Makes for easy horizontal; scaling• Map/Reduce
  18. 18. Features• Very, very fast• Super easy to install• Strong with major languages
  19. 19. Features: Querying• Rich, JavaScript based query syntax• Allows us to do deep, nested queriesdb.order.find( {shipping: { carrier:”usps” }} ); shipping is an embedded document (object)
  20. 20. Features: Official Drivers• .NET, Java, JavaScript, Ruby, Node.js, PH P, Haskell, C/C++, Perl
  21. 21. Concepts: Document-Oriented• Think of “documents” as objects/database records• Documents are basically just JSON in binary• Ability to store information all together
  22. 22. Concepts: Document-Oriented
  23. 23. Concepts: Document-Oriented Concept Mapping
  24. 24. Concepts: Cursors• Queries return “cursors” instead of collections • A cursor allows you to iterate through the result set • A big reason for this is performance • Much more efficient than loading all objects into memory
  25. 25. Concepts: Cursors• The find() function returns a cursor object
  26. 26. Basic Operations• Insert• Find• Update• Remove• ensureIndex
  27. 27. Basic Operations• Insertdb.test.insert({hello:’world’});• Find oEquivalent of Select * FROM test;
  28. 28. Basic Operations:Updatedb.test.update(<condition>,<operation>)
  29. 29. Basic Operations: Removedb.test.remove(<condition>)
  30. 30. Basic Operations: Indexing• Its usually a good idea to index collections• How and which columns depend on what is to be donedb.test.ensureIndex({hello:I})
  31. 31. MongoDB in action!
  32. 32. References• MongoDB home at http://www.mongodb.org• MongoDB - The Definitive Guide by Kristina Chodorow and Dirolf• NoSQL Paper at http://wiki.hsr.ch/Datenbanken/files/Weber_NoSQL_ Paper.pdf• Why MongoDB is awesome at http://www.slideshare.net/jnunemaker/why- mongodb-is-awesome• MongoDB wiki at http://en.wikipedia.org/wiki/MongoDB
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×