Lecture 21: NoSQL III. Monday, April 20, 2015

Similar documents
NoSQL Databases. Nikos Parlavantzas

Dr. Chuck Cartledge. 15 Oct. 2015

L7_L10. MongoDB. Big Data and Analytics by Seema Acharya and Subhashini Chellappan Copyright 2015, WILEY INDIA PVT. LTD.

MongoDB Developer and Administrator Certification Course Agenda

Programming Autodesk PLM 360 Using REST. Doug Redmond Software Engineer, Autodesk

NOSQL INTRODUCTION WITH MONGODB AND RUBY GEOFF

Analytics March 2015 White paper. Why NoSQL? Your database options in the new non-relational world

Document Oriented Database

Introduction to XML. Data Integration. Structure in Data Representation. Yanlei Diao UMass Amherst Nov 15, 2007

Why NoSQL? Your database options in the new non- relational world IBM Cloudant 1

NoSQL replacement for SQLite (for Beatstream) Antti-Jussi Kovalainen Seminar OHJ-1860: NoSQL databases

MongoDB. An introduction and performance analysis. Seminar Thesis

SURVEY ON MONGODB: AN OPEN- SOURCE DOCUMENT DATABASE

Semistructured data and XML. Institutt for Informatikk INF Ahmet Soylu

NoSQL Databases, part II

Getting Started with MongoDB

CSE 530A Database Management Systems. Introduction. Washington University Fall 2013

Certified MongoDB Professional VS-1058

extensible record stores document stores key-value stores Rick Cattel s clustering from Scalable SQL and NoSQL Data Stores SIGMOD Record, 2010

A basic create statement for a simple student table would look like the following.

Big Data Solutions. Portal Development with MongoDB and Liferay. Solutions

Can the Elephants Handle the NoSQL Onslaught?

CSCC09F Programming on the Web. Mongo DB

NoSQL - What we ve learned with mongodb. Paul Pedersen, Deputy CTO paul@10gen.com DAMA SF December 15, 2011

Вовченко Алексей, к.т.н., с.н.с. ВМК МГУ ИПИ РАН

D61830GC30. MySQL for Developers. Summary. Introduction. Prerequisites. At Course completion After completing this course, students will be able to:

The evolution of database technology (II) Huibert Aalbers Senior Certified Executive IT Architect

NoSQL web apps. w/ MongoDB, Node.js, AngularJS. Dr. Gerd Jungbluth, NoSQL UG Cologne,

Cloud Scale Distributed Data Storage. Jürmo Mehine

Databases 2 (VU) ( )

Tobby Hagler, Phase2 Technology

these three NoSQL databases because I wanted to see a the two different sides of the CAP

Scalable ecommerce with NoSQL. Dipali Trivedi

Comparing SQL and NOSQL databases

ANDROID APPS DEVELOPMENT FOR MOBILE GAME

How SourceForge is Using MongoDB

Database Design for NoSQL Systems

NoSQL in der Cloud Why? Andreas Hartmann

Hacettepe University Department Of Computer Engineering BBM 471 Database Management Systems Experiment

Overview of Databases On MacOS. Karl Kuehn Automation Engineer RethinkDB

The MongoDB Tutorial Introduction for MySQL Users. Stephane Combaudon April 1st, 2014

Oracle NoSQL Database Product Overview. Robert Greene Product Manager / Strategist Nov 19, 2014

Heterogeneous databases mediation

NoSQL's biggest secret: SQL went nowhere Matthew Revell Director of Developer Advocacy, Couchbase

SQL VS. NO-SQL. Adapted Slides from Dr. Jennifer Widom from Stanford

How, What, and Where of Data Warehouses for MySQL

NoSQL Database Systems and their Security Challenges

Instant SQL Programming

Understanding NoSQL Technologies on Windows Azure

Achieving Database Interoperability Across Data Access APIs through SQL Up-leveling

Structured Data Storage

Building Your First MongoDB Application

Enterprise Operational SQL on Hadoop Trafodion Overview

OTN Developer Day: Oracle Big Data. Hands On Lab Manual. Introduction to Oracle NoSQL Database

An Approach to Implement Map Reduce with NoSQL Databases

SQL. Short introduction

NoSQL: Going Beyond Structured Data and RDBMS

Lecture Data Warehouse Systems

Integrating Big Data into the Computing Curricula

An Open Source NoSQL solution for Internet Access Logs Analysis

Last Week. XML (extensible Markup Language) HTML Deficiencies. XML Advantages. Syntax of XML DHTML. Applets. Modifying DOM Event bubbling

Perl & NoSQL Focus on MongoDB. Jean-Marie Gouarné jmgdoc@cpan.org

Brad Dayley. NoSQL with MongoDB

NoSQL Systems for Big Data Management

Quiz! Database Indexes. Index. Quiz! Disc and main memory. Quiz! How costly is this operation (naive solution)?

Querying MongoDB without programming using FUNQL

Schema Extraction of Document Database - MongoDB. Master of Engineering. Computer Science and Engineering. Submitted By.

NORWEGIAN UNIVERSITY OF SCIENCE AND TECHNOLOGY DEPARTMENT OF CHEMICAL ENGINEERING ADVANCED PROCESS SIMULATION. SQL vs. NoSQL

MongoDB in the NoSQL and SQL world. Horst Rechner Berlin,

Evaluating NoSQL for Enterprise Applications. Dirk Bartels VP Strategy & Marketing

Making Sense ofnosql A GUIDE FOR MANAGERS AND THE REST OF US DAN MCCREARY MANNING ANN KELLY. Shelter Island

Programming Database lectures for mathema

The SQL++ Unifying Semi-structured Query Language, and an Expressiveness Benchmark of SQL-on-Hadoop, NoSQL and NewSQL Databases

Understanding NoSQL on Microsoft Azure

Introduction to NoSQL and MongoDB. Kathleen Durant Lesson 20 CS 3200 Northeastern University

MapReduce with Apache Hadoop Analysing Big Data

A COMPARATIVE STUDY OF NOSQL DATA STORAGE MODELS FOR BIG DATA

Comparison of the Frontier Distributed Database Caching System with NoSQL Databases

DYNAMIC QUERY FORMS WITH NoSQL

NoSQL Database - mongodb

NoSQL Databases. Institute of Computer Science Databases and Information Systems (DBIS) DB 2, WS 2014/2015

ADVANCED DATABASES PROJECT. Juan Manuel Benítez V Gledys Sulbaran

Database Systems. Lecture 1: Introduction

Database Management System Choices. Introduction To Database Systems CSE 373 Spring 2013

A Logical Approach to NoSQL Databases

KIN 104 FITNESS AND WELLNESS ONLINE LECTURE Summer 2016

INTRODUCTION TO CASSANDRA

Big data and urban mobility

Oracle Database 10g Express

How graph databases started the multi-model revolution

Transcription:

Lecture 21: NoSQL III Monday, April 20, 2015

Announcements Issues/questions with Quiz 6 or HW4? This week: MongoDB Next class: Quiz 7 Make-up quiz: 04/29 at 6pm (or after class) Reminders: HW 4 and Project Phase 2 due next Monday 04/27 Lightning talks also next Monday 04/27

MongoDB Outline Data model JSON syntax Semi-structured data Query language Inserts, updates, deletes Replication and sharding

Additional Resources on MongoDB http://docs.mongodb.org/manual/ Main source on MongoDB, but hard to read http://www.rfc-editor.org/rfc/rfc7159.txt Authority on JSON http://www.mongodb.com/presentations/ Presentations on MongoDB Reading: textbook chapter 9

Data Model A MongoDB instance contains a number of databases. A database holds a set of collections. A collection holds a set of documents. A document = JSON object = set of unordered keyvalue pairs = nested or not = schema-less Other NoSQL document stores: CouchDB, Couchbase, SimpleDB, Terrastore

MongoDB as Semi-structured Data Relational databases have rigid schema Schema evolution is costly MongoDB is flexible: semi-structured data model Store and query data in JSON Warning: not normal form. Not even 1NF!

JSON Syntax Basic constructs Base values number, string, boolean, null Objects { } sets of key-value pairs Arrays [ ] lists of values JSON describes the content

JSON Terminology JSON object: set of unordered elements elements: key/value pairs keys: business_id, full_address, open, keys must be unique within an object values: true, 9, AZ, [ Doctors, Health & Medical ] values can contain objects empty value: null, [] (or simply omit element) well-formed JSON object: elements surrounded by curly braces

Comparison MongoDB Database Collection Document _id field Oracle Schema Table Record Primary Key

More syntax: _id and references { } { } _id : 555, name : Jane _id : 444, name : Sarah, mother : 555 MongoDB documents in a collection must have unique identifier Documents can be referenced using unique identifier References in JSON are just syntax

JSON as Data JSON is self-describing Keys become part of the data Relational schema: persons(name, phone) In JSON name, phone are part of the data, and are repeated many times Consequence: JSON is much more flexible JSON = semi-structured data

Mapping Relational Data to JSON Persons collection Canonical mapping: document document document Persons Table Name Phone Jane 3634 Sarah 6343 David 6363 name phone name phone name phone Jane 3634 Sarah 6343 David 6363 Persons Collection { name : Jane, phone : 3634 } { name : Sarah, phone : 6343 } { name : David, phone : 6363 }

Mapping Relational Data to JSON Natural mapping: Customers Id Name Phone 10 Jane 3634 12 Sarah 6343 Orders Id Cust_Id Date Product 505 10 04-20-15 Apple Watch 500 10 04-19-15 iphone6 100 12 04-01-14 MacBook Customers { _id : 10, name : Jane, phone : 3634, orders : [{ _id : 505, date : 04-20-15, product : Apple Watch }, { _id : 500, date : 04-19-15, product : iphone6 }] } { _id : 12, name : Sarah, phone : 6343, orders : [{ _id : 100, date : 04-01-14, product : MacBook }] }

JSON is Semi-structured Data Missing elements: { name : Jane, phone : 3634 } { name : Jim } no phone Could represent in a table with nulls: name phone Jane 1234 Jim -

JSON is Semi-structured Data Repeated elements: { name : Jane, phones : [3634, 2345] } Two phones Difficult with tables: name phone Jane 3456 2345???

JSON is Semi-structured Data Elements with different types in different documents { name : { firstname : Jane, lastname : Smith }, phone : 3634 } { name : Jim } structured name Nested objects (no 1NF) Heterogeneous documents: collection contains documents with structured names and unstructured names

Typical MongoDB Applications Web applications Content management systems Ecommerce Event logging Evolving schema Quickly add a new element Data exchange Take the data, don t worry about schema

Approaches to JSON Processing Via API Called DOM Navigate, update the JSON arbitrarily BUT: memory bound Via some query language: MongoDB query language Stand-alone processing in shell OR embedded in client-side program

MongoDB Operations Will discuss next: query language insert, update, and delete

Sample Documents for Queries

Find db.collection.find({query}, {projection}) {query} = the search criteria {projection} = the fields to display Notice the use of { and }

Find db.books.find() Result: all documents in book collection db.posts.find({"author" : "Dan Sullivan"}, {"title" : 1, "book_id" : 1, " _id " : 0}) Result: { "book_id": "552020", "title": "NoSQL for Mere Mortals"} db.books.find({"author" : "Dan Sullivan"}, {"title" : 1, "_id" : 0}) Result: {"title" : "NoSQL for Mere Mortals"}

Range Query db.books.find({"year" : {"$gte" : 2012, "$lte" : 2015 }}) Result: { "book_id": "3450", "authors": ["Pramod J. Sadalage", "Martin Fowler"], "title": "NoSQL Distilled", "publisher": "Addison-Wesley", "year": 2012, "isbn": 9780321826626, "comments": [ {"author": "Matt", "text": "Nice overview of NoSQL systems"}, {"author": "Thomas", "text": "Slightly out-of-date, but still relevant"}] }

Negation Query db.books.find({"book_id" : {"$ne" : 552020}}) Result: { "book_id": "3450", "authors": ["Pramod J. Sadalage", "Martin Fowler"], "title": "NoSQL Distilled", "publisher": "Addison-Wesley", "year": 2012, "isbn": 9780321826626, "comments": [ {"author": "Matt", "text": "Nice overview of NoSQL systems"}, {"author": "Thomas", "text": "Slightly out-of-date, but still relevant"}] }

Or Queries db.books.find({"isbn": {"$in": [9876543210, 0123456789]}}) Result: empty (there were no books with either of those Result: ISBN values) db.books.find({"$or": [{"author": "Dan Sulivan"}, {isbn: 9780134023212}]}) { "book_id" : "552020", "author" : "Dan Sullivan", } "title" : "NoSQL for Mere Mortals", "publisher" : "Addison-Wesley", "date" : "05-08-2015", "isbn" : 9780134023212, "comments : [ {"author" : "Anonymous", "text" : "How do I get an advanced copy?"} ]

Next Class Remainder of query language Replication and sharding Quiz 7