COMP 430 Intro. to Database Systems MongoDB. What is MongoDB? “Humongous” DB NoSQL, no schemas DB Lots of similarities with SQL RDBMs, but with more flexibility.

Slides:



Advertisements
Similar presentations
UNIVERSITY OF PALESTINE business computer application College of Business Instructor: Mr. Ahmed Abumosameh.
Advertisements

CSE 190: Internet E-Commerce Lecture 10: Data Tier.
An introduction to MongoDB Rácz Gábor ELTE IK, febr. 10.
Jeff Lemmerman Matt Chimento Medtronic Confidential 1 9th Annual CodeFreeze Symposium Medtronic Energy and Component Center.
A Social blog using MongoDB ITEC-810 Final Presentation Lucero Soria Supervisor: Dr. Jian Yang.
VICTORIA UNIVERSITY OF WELLINGTON Te Whare Wananga o te Upoko o te Ika a Maui SWEN 432 Advanced Database Design and Implementation MongoDB Read Lecturer.
VICTORIA UNIVERSITY OF WELLINGTON Te Whare Wananga o te Upoko o te Ika a Maui SWEN 432 Advanced Database Design and Implementation MongoDB Write Lecturer.
VICTORIA UNIVERSITY OF WELLINGTON Te Whare Wananga o te Upoko o te Ika a Maui SWEN 432 Advanced Database Design and Implementation MongoDB Data Modeling.
Database Relationships Objective 5.01 Understand database tables used in business.
AN INTRODUCTION TO NOSQL DATABASES Karol Rástočný, Eduard Kuric.
Cloud Computing Lecture Column Store – alternative organization for big relational data.
Systems analysis and design, 6th edition Dennis, wixom, and roth
Intro to JDBC To effectively use Java Data Base Connectivity we must understand: 1.Relational Database Management Systems (RDBMS) 2.JDBC Drivers 3.SQL.
CHAPTER 7 Database: SQL, MySQL. Topics  Introduction  Relational Database Model  Relational Database Overview: Books.mdb Database  SQL (Structured.
 SQL stands for Structured Query Language.  SQL lets you access and manipulate databases.  SQL is an ANSI (American National Standards Institute) standard.
MongoDB An introduction. What is MongoDB? The name Mongo is derived from Humongous To say that MongoDB can handle a humongous amount of data Document.
CIS 270—Application Development II Chapter 25—Accessing Databases with JDBC.
NoSQL continued CMSC 461 Michael Wilson. MongoDB  MongoDB is another NoSQL solution  Provides a bit more structure than a solution like Accumulo  Data.
WTT Workshop de Tendências Tecnológicas 2014
RELATIONSHIPS Generally there are two main database types: flat-file and relational.
PowerPoint Presentation for Dennis, Wixom, & Tegarden Systems Analysis and Design with UML, 4th Edition Copyright © 2009 John Wiley & Sons, Inc. All rights.
Methodological Foundations of Biomedical Informatics (BMSC-GA 4449) Himanshu Grover.
SQL 101 for Web Developers 14 November What is a database and why have one? Tables, relationships, normalization SQL – What SQL is and isn’t – CRUD:
Object Persistence (Data Base) Design Chapter 13.
WEEK 1, DAY 2 STEVE CHENOWETH CSSE DEPT CSSE 533 –INTRO TO MONGODB.
Visual C# 2012 How to Program © by Pearson Education, Inc. All Rights Reserved.
IST 220 Introduction to Databases Course Wrap-up.
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.
MongoDB is a database management system designed for web applications and internet infrastructure. The data model and persistence strategies are built.
Nikolay Kostov Telerik Corporation
IST 220 – Intro to Databases Lecture 3 Database Design Guidelines.
SQL Jan 20,2014. DBMS Stores data as records, tables etc. Accepts data and stores that data for later use Uses query languages for searching, sorting,
Using SQL Connecting, Retrieving Data, Executing SQL Commands, … Svetlin Nakov Technical Trainer Software University
Introduction to MongoDB
Lesson 2: Designing a Database and Creating Tables.
 2001 Prentice Hall, Inc. All rights reserved. 1 Chapter 22 - SQL, MySQL, DBI and ADO Outline 22.1 Introduction 22.2 Relational Database Model 22.3 Relational.
Database Design for NoSQL System GROUP 18: Lê Nhựt Trường Phạm Thành Trí Nguyễn Ngọc Tuyển Võ Thái Tuyến.
Modeling MongoDB with Relational Model Proposed by Christopher Polanco.
MongoDB First Light. Mongo DB Basics Mongo is a document based NoSQL. –A document is just a JSON object. –A collection is just a (large) set of documents.
Mongodb.org A. Im, G. Cai, H. Tunc, J. Stevens, Y. Barve, S. Hei Vanderbilt University.
Session 1 Module 1: Introduction to Data Integrity
CSCI 3328 Object Oriented Programming in C# Chapter 12: Databases and LINQ – Exercises 1 Xiang Lian The University of Texas Rio Grande Valley Edinburg,
Database: SQL, MySQL, LINQ and Java DB © by Pearson Education, Inc. All Rights Reserved.
Distribution of Marks For Second Semester Internal Sessional Evaluation External Evaluation Assignment /Project QuizzesClass Attendance Mid-Term Test Total.
PowerPoint Presentation for Dennis, Wixom, & Tegarden Systems Analysis and Design with UML, 5th Edition Copyright © 2015 John Wiley & Sons, Inc. All rights.
NoSQL: Graph Databases. Databases Why NoSQL Databases?
Database Relationships Objective 5.01 Understand database tables used in business.
Introduction to MongoDB. Database compared.
NoSQL databases A brief introduction NoSQL databases1.
SQL Basics Review Reviewing what we’ve learned so far…….
Introduction to Databases & SQL Ahmet Sacan. What you’ll need Firefox, SQLite plugin Mirdb and Targetscan databases.
1 Section 1 - Introduction to SQL u SQL is an abbreviation for Structured Query Language. u It is generally pronounced “Sequel” u SQL is a unified language.
CSE-291 (Distributed Systems) Winter 2017 Gregory Kesden
Fundamentals of DBMS Notes-1.
NO SQL for SQL DBA Dilip Nayak & Dan Hess.
and Big Data Storage Systems
MongoDB Er. Shiva K. Shrestha ME Computer, NCIT
 2012 Pearson Education, Inc. All rights reserved.
WinCC OA NextGen Archiver: OSS Database selection process Dipl. -Ing
COMP 430 Intro. to Database Systems
Dineesha Suraweera.
COMP 430 Intro. to Database Systems
MongoDB CRUD Operations
javascript for your data
NOSQL databases and Big Data Storage Systems
CSE-291 (Cloud Computing) Fall 2016 Gregory Kesden
The University of Texas – Pan American
MongoDB Read/Write.
CSE 482 Lecture 5: NoSQL.
CS5220 Advanced Topics in Web Programming Introduction to MongoDB
Presentation transcript:

COMP 430 Intro. to Database Systems MongoDB

What is MongoDB? “Humongous” DB NoSQL, no schemas DB Lots of similarities with SQL RDBMs, but with more flexibility No joins because data is denormalized & pre-joined Open source

Collections of documents { _id: “S1234”, first_name: “John”, last_name: “Smith”, major: “ECON” } { _id: “S5678”, first_name: “Mary”, last_name: “Jones”, major: “COMP”, minor: “STAT” } Collection = table Document = record Every document has unique _id, even if not user-defined. Documents need not have the same fields.

Relating data via embedding { _id: “S1234”, first_name: “John”, last_name: “Smith”, major: “ECON”, address: { street: “1514 Nowhere St.”, city: “Houston”, state: “TX” } Data all stored together for locality. Denormalized. Possible redundancy.

Relating data via embedding { _id: “S1234”, first_name: “John”, last_name: “Smith”, major: “ECON”, addresses: [{ street: “1514 Nowhere St.”, city: “Houston”, state: “TX”}, {street: “7729 Somewhere St.”, city: “Kansas City”, state: “KS”} ] }

Relating data via references { _id: first_name: “John”, last_name: “Smith” } { title: “A book about books”, author: } { title: “A little bookish book”, author: } { title: “A new book”, author: } _id field = primary key Reference = foreign key

Relating data via references { first_name: “John”, last_name: “Smith”, books: [103, 279, 541] } { _id: 103, title: “A book about books” } { _id: 279, title: “A little bookish book” } { _id: 541, title: “A new book” } _id field = primary key Reference = foreign key

Relating data via embedding + references { first_name: “John”, last_name: “Smith” books: [103, 279, 541] } { first_name: “Mary”, last_name: “Jones”, books: [103, 541] } { _id: 103, title: “A book about books” } { _id: 279, title: “A little bookish book” } { _id: 541, title: “A new book” } Denormalized. Many-to-many junction info put in one document.

Embedding & relating replaces joins No need for joins, because data is already explicitly linked. This gives up SQL’s flexibility of joining on conditions other that PK=FK. Focus on the common case.

DB/application interface Intention is for DB & application to have equivalent data representation. Explicit references Built-in lists and associative arrays Flexible field types Flexible field membership

Storage model Emphasize data locality: Each document stored as one unit, even with embedding Each collection stored as one unit. Uses BSON, a binary-encoded variant of JSON key/value pairs

CRUD operations SQL-like, but with a library

Filtering db.students.find({major: “COMP”}) db.students.find({major: “COMP”, minor: “STAT”}) db.students.find({$or: [{major: “COMP”}, {major: “ELEC”}]}) db.students.find({major: {$in: [“COMP”, “ELEC”]}}) db.students.find({gpa: {$gt: 3.8}}) db.students.find({address.street: {$exists: true}}) Collection name Syntax structured as key/value pairs with some special $keywords. Embedded field name

Selecting fields db.students.find({major: “COMP”}, {first_name: true, last_name: true, major: false}) FilterSpecifies desired fields.

db.students.insert({first_name: “Susan”, last_name: “Walsh”}) db.students.update({first_name: “John”, last_name: “Smith”}, {$set: {major: “HIST”}}, {multi: true, upsert: true}) db.students.update({first_name: “John”, last_name: “Smith”}, {first_name: “Jonathan”, last_name: “Smythe”}) db.students.update({major: “COMP”}, {$unset: {minor: “”}}) Filter Change multiple documents? Insert if no match found? Delete field. Change entire document. Inserting & updating Change only this.

Deleting db.students.remove({major: “COMP”})

Transactions db.students.update(…, $isolated: true) db.students.remove(…, $isolated: true) By default, each write to a document is atomic. Make entire collections’ writes atomic. Not intended for transaction-heavy systems.

Some other features

Grouping & aggregation db.students.aggregate({$match: …}, {$group: …}, {$sort: …}) db.students.group(…) db.students.mapReduce(map_fn, reduce_fn) db.students.distinct(“major”)

B-tree indices db.students.ensureIndex({last_name: 1, gpa: -1}) Creates index that first orders last_name ascending, then gpa decending. Automatically create index on _id.

Data distribution Supports replication & sharding (partitioning)