140 likes | 216 Vues
CSE 3330 Database Concepts. MongoDB. Big Data. Surge in “big data” Larger datasets frequently need to be stored in dbs Traditional relational db were not designed for such scenario.
E N D
CSE 3330 Database Concepts MongoDB
Big Data • Surge in “big data” • Larger datasets frequently need to be stored in dbs • Traditional relational db were not designed for such scenario. • Problems of:- Scalability- “Relational” becomes a problem * need to load two or more tables in memory- Do not take advantage of high performance processing, multiplecores, distributed processing, etc
NoSQL databases • NoSQLdbs have following properties:- non-relationalrelations are not stored as PK or FK constraints- distributed- open-source- scalable- high-performance- order of magnitude faster than relational dbs
MongoDB • One of the most popular NoSQLdb • Features:- JSON-style documentsdocument contains one instance of the datacan be thought of as a row in a traditional db- Faster querying- Index support- Highly flexible- More details at:https://www.mongodb.org/
MongoDB MongoDB is consists of a collection of documents.- A document is a record consisting of key value pairs.
MongoDBvs Traditional http://www.mongodb.com/nosql-explained
MongoDB example Schema is created dynamically: Example: db.students.insert({firstName: ‘John’,lastName: ‘Smith’, studentID: ‘1234’, major: ‘CSE’,termAdmitted: ‘Fall2013’});
MongoDB example Schema is created dynamically: Note that there was no need for create database or create table commands.
MongoDB example It’s easy to project columns, find valueshttp://docs.mongodb.org/manual/core/read-operations-introduction/
MongoDB example It’s easy to project columns, find valueshttp://docs.mongodb.org/manual/core/read-operations-introduction/
MongoDB example Look at two tutorials: http://code.tutsplus.com/tutorials/getting-started-with-mongodb-part-1--net-22879 http://code.tutsplus.com/tutorials/getting-started-with-mongodb-part-2--net-23636
MongoDB example Download taco truck insert statements. Run queries for: • Find total types of itemsi.e. how many different itemTypes are there • Find the items which have itemType of “sauces” • Find items which have itemType of “sauces” and name=“Tomatillo” • Try to sort by price