SlideShare una empresa de Scribd logo
1 de 42
Modeling JSON data for
document databases
Ryan CrawCour
Program Manager, Microsoft
@ryancrawcour
David Makogon
Cloud Architect, Microsoft
@dmakogon
Today’s talk
• What are document databases?
• What is Azure DocumentDB?
• Modeling data for a document database
Loud applause and lots of great
tweets about #DocumentDB @
#CloudDevelop !
Kinds of databases
• Relational
• Column
• Key Value
• Graph
• Document
What are document
databases?
Document Databases
• Part of NoSQL family
• Built for simplicity
• Built for scale and performance
• Non-relational
• No enforced schema
{
"name": "SmugMug",
"permalink": "smugmug",
"homepage_url": "http://www.smugmug.com",
"blog_url": "http://blogs.smugmug.com/",
"category_code": "photo_video",
"products": [
{
"name": "SmugMug",
"permalink": "smugmug"
}
],
"offices": [
{
"description": "",
"address1": "67 E. Even Ave, Suite 200",
"address2": "",
"zip_code": "94041",
"city": "Mountain View",
"state_code": "CA",
"country_code": "USA",
"latitude": 37.390056,
"longitude": -122.067692
}
]
}
Document Databases
{
“id": “itemdata2344",
“data": “TWFuIGlzIGRpc3Rpbmd1aXNoZWQsIG5vd
cyByZWFzb24sIGJ1dCBieSB0aGlzHNpbmd1bG
nJvbSBvdGhlciBhbmltYWxzLCB3aGljaCBpcyYg
dGhlIG1pbmQsIHRoYXQgYnkgYSBwZXJzZXZlsaW
dodCBpbiB0aGUgY29udGludWVkIGFuZCBpbGdl
bmVyYXRpb24gb2Yga25vd2xlZGdlLCBleGNlZ9y
dCB2ZWhlbWVuY2Ugb2YgYW55IGNhcm5hS4=
cyByZWFzb24sIGJ1dCBieSB0aGlzHNpbmd1bGFyIZ
nJvbSBvdGhlciBhbmltYWxzLCB3aGljaCBpcyBh2Yg
dGhlIG1pbmQsIHRoYXQgYnkgYSBwZXJzZXZlGVsaW
dodCBpbiB0aGUgY29udGludWVkIGFuZCBpbmRlZGdl
bmVyYXRpb24gb2Yga25vd2xlZGdlLCBleGNlZWG9y
dCB2ZWhlbWVuY2Ugb2YgYW55IGNhcm5hbS4=
cyByZWFzb24sIGJ1dCBieSB0aGlzHNpbmd1bGF4gZ
nJvbSBvdGhlciBhbmltYWxzLCB3aGljaCBpg
dGhlIG1pbmQsIHRoYXQgYnkgYSBwZXJzZXZlcmVsaW
dodCBpbiB0aGUgY29udGludWVkIGFuZCBpbmRlIGdl
bmVyYXRpb24gb2Yga25vd2xlZGdlLCBleGNlZzaG9y
dCB2ZWhlbWVuY2Ugb2YgYW55IGNhcm5hbCBwZS4=”
}
• Part of NoSQL family
• Built for simplicity
• Built for scale and performance
• Non-relational
• No enforced schema
Document Databases
• Part of NoSQL family
• Built for simplicity
• Built for scale and performance
• Non-relational
• No enforced schema
Azure DocumentDB: Lightning Round Edition
{
name:"Azure DocumentDB",
deployedAs: "Service",
dbType: "Document",
connectVia: [ "rest", "sdk" ],
deployVia: [ "portal", "rest", "cli", "sdk" ],
scaleVia: [ "portal", "rest", "cli", "sdk" ],
differsVia: [ "js", "indexing", "consistency" ]
}
Modeling JSON
data in this brave
"new" world
Modeling data, the relational way
Come as you are
Data normalization
How do approaches differ?
To embed, or to reference, that is the question
embed reference
To embed, or to reference, that is the question
• Data from entities are queried together
To embed, or to reference, that is the question
• Data from entities are queried together
To embed, or to reference, that is the question
• Data from entities are queried together
{
id: "book1",
covers: [
{type: "front", artworkUrl: "http://..."},
{type: "back", artworkUrl: "http://..."}
]
index: "",
chapters: [
{id: 1, synopsis: "", quote: "", pageCount:24, wordCount:456},
{id: 1, synopsis: "", quote: "", pageCount:24, wordCount:456},
]
}
To embed, or to reference, that is the question
• Data from entities are queried together
• The child is a dependent e.g. Order Line depends on Order
{
id: "order1",
customer: "customer1",
orderDate: "2014-09-15T23:14:25.7251173Z"
lines: [
{product: "13inch screen" , price: 200.00, qty: 50 },
{product: "Keyboard", price:23.67, qty:4}
{product: "CPU", price:87.89, qty:1
]
}
To embed, or to reference, that is the question
• Data from entities are queried together
• The child is a dependent e.g. Order Line depends on Order
• 1:1 relationship
{
id: "person1",
name: "Mickey"
creditCard: {
number: "**** **** **** 4794"},
expiry: "06/2019"},
cvv: "868",
type: "Mastercard"
}
}
To embed, or to reference, that is the question
• Data from entities are queried together
• The child is a dependent e.g. Order Line depends on Order
• 1:1 relationship
• Similar volatility
{
id: "person1",
name: "Mickey",
contactInfo: [
{email: "mickey@disney.com"},
{mobile: "+1 555-5555"},
{twitter: "@MickeyMouse"}
]
}
To embed, or to reference, that is the question
• Data from entities are queried together
• The child is a dependent e.g. Order Line depends on Order
• 1:1 relationship
• Similar volatility
• The set of values or sub-documents is bounded (1:few)
{
id: "task1",
desc: "deliver an awesome presentation @ #CloudDevelop",
categories: ["conference", "talk", "workshop", "business"]
}
To embed, or to reference, that is the question
• Data from entities are queried together
• The child is a dependent e.g. Order Line depends on Order
• 1:1 relationship
• Similar volatility
• The set of values or sub-documents is bounded (1:few)
Typically denormalized data models provide better read performance
To embed, or to reference, that is the question
• one-to-many relationships (unbounded)
{
id: "post1",
author: "Mickey Mouse",
tags: [ "fun", "cloud", "develop"]
}
{id: "c1", postId: "post1", comment: "Coolest blog post"}
{id: "c2", postId: "post1", comment: "Loved this post, awesome"}
{id: "c3", postId: "post1", comment: "This is rad!"}
…
{id: "c10000", postId: "post1", comment: "You are the coolest cartoon character"}
…
{id: "c2000000", postId: "post1", comment: "Are we still commeting on this blog?"}
To embed, or to reference, that is the question
• one-to-many relationships (unbounded)
• many-to-many relationships
{
id: "book1",
name: "100 Secrets of Disneyland"
}
{
id: "book2",
name: "The best places to eat @ Disney"
}
{
author-id: "author1",
book-id: "book1"
}
{
author-id: "author2",
book-id: "book1"
}
{
id: "author1",
name: "Mickey Mouse"
}
{
id: "author2",
name: "Donald Duck"
}
Look familiar? It should …. It's the "relational" way
To embed, or to reference, that is the question
• one-to-many relationships (unbounded)
• many-to-many relationships
{
id: "book1",
name: "100 Secrets of Disneyland",
authors: ["author1", "author2"]
}
{
id: "book2",
name: "The best places to eat @ Disney”,
authors: ["author1"]
}
{
id: "author1",
name: "Mickey Mouse",
books: ["book1", "book2"]
}
{
id: "author2",
name: "Donald Duck"
books: ["book1"]
}
To embed, or to reference, that is the question
• one-to-many relationships (unbounded)
• many-to-many relationships
• Related data changes frequently
• The referenced entity is a key entity used by many others
{
id: "person1", author: "Mickey Mouse", stocks: [ "dis", "msft", "nflx"]
}
{
id: "dis",
opening: "52.09",
numerOfTrades: 10000,
trades: [{time: 083745, qty:57, price: 53.97}, {time: 083746, qty:5, price: 54.01}]
}
To embed, or to reference, that is the question
• one-to-many relationships (unbounded)
• many-to-many relationships
• Related data changes frequently
• The referenced entity is a key entity used by many others
Normalized data models can require more round trips to the server.
Typically normalizing provides better write performance.
Where do you put the reference?
Publisher & Book … does publisher refer to book?
Publisher document:
{
id: "mspress",
name: "Microsoft Press",
books: [ 1, 2, 3, ..., 100, ..., 1000]
}
Book documents:
{id: 1, name: "DocumentDB 101" }
{id: 2, name: "DocumentDB for RDBMS Users" }
{id: 3, name: "Taking over the world one JSON doc at a time" }
Where do you put the reference?
Publisher & Book … does or book refer to publisher?
Publisher document:
{
id: "mspress",
name: "Microsoft Press",
books: [ 1, 2, 3, ..., 100, ..., 1000]
}
Book documents:
{id: 1, name: "DocumentDB 101", pub-id: "mspress"}
{id: 2, name: "DocumentDB for RDBMS Users", pub-id: "mspress"}
{id: 3, name: "Taking over the world one JSON doc at a time", pub-id: "mspress"}
Is it always black or white?
Is it always black or white?
Is it always black or white?
{
id: 1,
firstName: "Mickey",
lastName: "Mouse",
books: [1, 2, 3],
images: [
{"thumbnail": "http://....png"},
{"profile": "http://....png"},
],
bio: "Mickey Mouse is a funny animal cartoon
character and the official mascot of The Walt
Disney Company. An anthropomorphic mouse
who typically wears red shorts, large yellow shoes,
and white gloves, Mickey has become one of the
most recognizable cartoon characters."
}
{
id: 1,
name: "DocumentDB 101",
authors": [
{
id: 1,
name: "Mickey Mouse",
bio: "Mickey Mouse is a funny animal
cartoon character and the
official mascot of The
Walt Disney Company…",
thumbnailUrl: "http://....png"
}
]
}
How to model hierarchical trees?
Jill
Ben Susan
SvenAndrew
Thomas
{
{ id: "Jill" },
{ id: "Ben", manager: "Jill" },
{ id: "Susan", manager: "Jill" },
{ id: "Andrew", manager: "Ben" },
{ id: "Sven", manager: "Susan" },
{ id: "Thomas", manager: "Sven" }
}
SELECT manager FROM org WHERE id = "Susan"
To get the manager of any employee is trivial -
How to model hierarchical trees?
Jill
Ben Susan
SvenAndrew
Thomas
{
{ id: "Jill" },
{ id: "Ben", manager: "Jill" },
{ id: "Susan", manager: "Jill" },
{ id: "Andrew", manager: "Ben" },
{ id: "Sven", manager: "Susan" },
{ id: "Thomas", manager: "Sven" }
}
SELECT * FROM org WHERE manager = "Jill"
To get all employees where Jill is the manager is also easy -
How to model hierarchical trees?
Jill
Ben Susan
SvenAndrew
Thomas
{
{ id: "Jill", directs: ["Ben", "Susan"] },
{ id: "Ben", directs: ["Andrew"] },
{ id: "Susan", directs: ["Sven"] },
{ id: "Andrew" },
{ id: "Sven", directs: ["Thomas"] },
{ id: "Thomas" }
}
SELECT * FROM org WHERE id = "Jill"
To get all direct reports for Jill is easy -
How to model hierarchical trees?
Jill
Ben Susan
SvenAndrew
Thomas
{
{ id: "Jill", directs: ["Ben", "Susan"] },
{ id: "Ben", directs: ["Andrew"] },
{ id: "Susan", directs: ["Sven"] },
{ id: "Andrew" },
{ id: "Sven", directs: ["Thomas"] },
{ id: "Thomas" }
}
SELECT *
FROM emp
WHERE ARRAY_CONTAINS(emp.directs, "Ben")
To find the manager for an employee is possible -
How to support keyword search?
{
id: "CDC101",
title: "Fundamentals of database design",
credits: 10 }
}
How to support keyword search?
{
id: "CDC101",
title: “The Fundamentals of Database Design",
titleWords: [ "fundamentals", "database", "design", "database design" ],
credits: 10
}
Consider using a RegEx to transform words to lowercase and remove any punctuation.
Strip out stop words like “to”, “the”, “of” etc.
Denormalize keywords in to key phrases
Summary
{
options: ["Embed", "Reference"],
rules: "There are no rules, merely guidelines",
embed: [
"1:1",
"Child is a dependent",
"Similar volatility",
"favor read speed"
]
reference: [
"related data changes frequently",
"many:many",
"favor writes"
]
remember: [
"Don't be scared to experiment and mix & match",
"Models change & evolve",
"Hybrid models"
]
}
Summary
Azure DocumentDB SDKs and Tooling
SDKs
aka.ms/docdbsdks
Azure Portal
portal.azure.com
Studio
aka.ms/docdbstudio
Get Started Today
explore playground
select * from
playground p where
p.name = "DocumentDB"
aka.ms/docdbplayground
build an app
aka.ms/docdbstarter
move some data
aka.ms/docdbimport
http://aka.ms/CloudDevelop
• Dell Venue Pro 8
• Enter by filling out survey
• Announced at the end of the
day.
• Must be present to win.
Wrapping up
• documentdb.com
• @DocumentDB
• @dmakogon
• @ryancrawcour

Más contenido relacionado

La actualidad más candente

Benefits of using MongoDB: Reduce Complexity & Adapt to Changes
Benefits of using MongoDB: Reduce Complexity & Adapt to ChangesBenefits of using MongoDB: Reduce Complexity & Adapt to Changes
Benefits of using MongoDB: Reduce Complexity & Adapt to ChangesAlex Nguyen
 
Mongo DB: Fundamentals & Basics/ An Overview of MongoDB/ Mongo DB tutorials
Mongo DB: Fundamentals & Basics/ An Overview of MongoDB/ Mongo DB tutorialsMongo DB: Fundamentals & Basics/ An Overview of MongoDB/ Mongo DB tutorials
Mongo DB: Fundamentals & Basics/ An Overview of MongoDB/ Mongo DB tutorialsSpringPeople
 
MongoDB Schema Design by Examples
MongoDB Schema Design by ExamplesMongoDB Schema Design by Examples
MongoDB Schema Design by ExamplesHadi Ariawan
 
MongoDB World 2019 - A Complete Methodology to Data Modeling for MongoDB
MongoDB World 2019 - A Complete Methodology to Data Modeling for MongoDBMongoDB World 2019 - A Complete Methodology to Data Modeling for MongoDB
MongoDB World 2019 - A Complete Methodology to Data Modeling for MongoDBDaniel Coupal
 
An Introduction To NoSQL & MongoDB
An Introduction To NoSQL & MongoDBAn Introduction To NoSQL & MongoDB
An Introduction To NoSQL & MongoDBLee Theobald
 
Cool NoSQL on Azure with DocumentDB
Cool NoSQL on Azure with DocumentDBCool NoSQL on Azure with DocumentDB
Cool NoSQL on Azure with DocumentDBJan Hentschel
 
NoSQL: Why, When, and How
NoSQL: Why, When, and HowNoSQL: Why, When, and How
NoSQL: Why, When, and HowBigBlueHat
 
Introduction à DocumentDB
Introduction à DocumentDBIntroduction à DocumentDB
Introduction à DocumentDBMSDEVMTL
 
Azure doc db (slideshare)
Azure doc db (slideshare)Azure doc db (slideshare)
Azure doc db (slideshare)David Green
 
Introduction to mongo db
Introduction to mongo dbIntroduction to mongo db
Introduction to mongo dbRohit Bishnoi
 
Introduction to MongoDB
Introduction to MongoDBIntroduction to MongoDB
Introduction to MongoDBJustin Smestad
 

La actualidad más candente (20)

Benefits of using MongoDB: Reduce Complexity & Adapt to Changes
Benefits of using MongoDB: Reduce Complexity & Adapt to ChangesBenefits of using MongoDB: Reduce Complexity & Adapt to Changes
Benefits of using MongoDB: Reduce Complexity & Adapt to Changes
 
Mongo DB: Fundamentals & Basics/ An Overview of MongoDB/ Mongo DB tutorials
Mongo DB: Fundamentals & Basics/ An Overview of MongoDB/ Mongo DB tutorialsMongo DB: Fundamentals & Basics/ An Overview of MongoDB/ Mongo DB tutorials
Mongo DB: Fundamentals & Basics/ An Overview of MongoDB/ Mongo DB tutorials
 
MongoDB
MongoDBMongoDB
MongoDB
 
MongoDB Schema Design by Examples
MongoDB Schema Design by ExamplesMongoDB Schema Design by Examples
MongoDB Schema Design by Examples
 
Azure DocumentDB
Azure DocumentDBAzure DocumentDB
Azure DocumentDB
 
MongoDB World 2019 - A Complete Methodology to Data Modeling for MongoDB
MongoDB World 2019 - A Complete Methodology to Data Modeling for MongoDBMongoDB World 2019 - A Complete Methodology to Data Modeling for MongoDB
MongoDB World 2019 - A Complete Methodology to Data Modeling for MongoDB
 
The What and Why of NoSql
The What and Why of NoSqlThe What and Why of NoSql
The What and Why of NoSql
 
An Introduction To NoSQL & MongoDB
An Introduction To NoSQL & MongoDBAn Introduction To NoSQL & MongoDB
An Introduction To NoSQL & MongoDB
 
Mongo db operations_v2
Mongo db operations_v2Mongo db operations_v2
Mongo db operations_v2
 
Mongo db
Mongo dbMongo db
Mongo db
 
Cool NoSQL on Azure with DocumentDB
Cool NoSQL on Azure with DocumentDBCool NoSQL on Azure with DocumentDB
Cool NoSQL on Azure with DocumentDB
 
NoSQL: Why, When, and How
NoSQL: Why, When, and HowNoSQL: Why, When, and How
NoSQL: Why, When, and How
 
Introduction à DocumentDB
Introduction à DocumentDBIntroduction à DocumentDB
Introduction à DocumentDB
 
Azure doc db (slideshare)
Azure doc db (slideshare)Azure doc db (slideshare)
Azure doc db (slideshare)
 
No sql
No sqlNo sql
No sql
 
SQL & NoSQL
SQL & NoSQLSQL & NoSQL
SQL & NoSQL
 
Introduction to mongo db
Introduction to mongo dbIntroduction to mongo db
Introduction to mongo db
 
Introduction to MongoDB
Introduction to MongoDBIntroduction to MongoDB
Introduction to MongoDB
 
MongoDB
MongoDBMongoDB
MongoDB
 
Mongo DB
Mongo DBMongo DB
Mongo DB
 

Destacado

Analyze and visualize non-relational data with DocumentDB + Power BI
Analyze and visualize non-relational data with DocumentDB + Power BIAnalyze and visualize non-relational data with DocumentDB + Power BI
Analyze and visualize non-relational data with DocumentDB + Power BISriram Hariharan
 
Introduction to Azure DocumentDB
Introduction to Azure DocumentDBIntroduction to Azure DocumentDB
Introduction to Azure DocumentDBAlex Zyl
 
Developing Solutions with Azure DocumentDB
Developing Solutions with Azure DocumentDB Developing Solutions with Azure DocumentDB
Developing Solutions with Azure DocumentDB WinWire Technologies Inc
 
Microsoft Azure DocumentDB - Global Azure Bootcamp 2016
Microsoft Azure DocumentDB -  Global Azure Bootcamp 2016Microsoft Azure DocumentDB -  Global Azure Bootcamp 2016
Microsoft Azure DocumentDB - Global Azure Bootcamp 2016Sunny Sharma
 
Introduction to Azure DocumentDB
Introduction to Azure DocumentDBIntroduction to Azure DocumentDB
Introduction to Azure DocumentDBDenny Lee
 
Azure DocumentDB Overview
Azure DocumentDB OverviewAzure DocumentDB Overview
Azure DocumentDB OverviewAndrew Liu
 
Data Modeling for NoSQL
Data Modeling for NoSQLData Modeling for NoSQL
Data Modeling for NoSQLTony Tam
 
5 Data Modeling for NoSQL 1/2
5 Data Modeling for NoSQL 1/25 Data Modeling for NoSQL 1/2
5 Data Modeling for NoSQL 1/2Fabio Fumarola
 
Introducing DocumentDB
Introducing DocumentDB Introducing DocumentDB
Introducing DocumentDB James Serra
 
NoSQL Now! NoSQL Architecture Patterns
NoSQL Now! NoSQL Architecture PatternsNoSQL Now! NoSQL Architecture Patterns
NoSQL Now! NoSQL Architecture PatternsDATAVERSITY
 
Cassandra Data Modeling - Practical Considerations @ Netflix
Cassandra Data Modeling - Practical Considerations @ NetflixCassandra Data Modeling - Practical Considerations @ Netflix
Cassandra Data Modeling - Practical Considerations @ Netflixnkorla1share
 

Destacado (13)

Analyze and visualize non-relational data with DocumentDB + Power BI
Analyze and visualize non-relational data with DocumentDB + Power BIAnalyze and visualize non-relational data with DocumentDB + Power BI
Analyze and visualize non-relational data with DocumentDB + Power BI
 
Introduction to Azure DocumentDB
Introduction to Azure DocumentDBIntroduction to Azure DocumentDB
Introduction to Azure DocumentDB
 
Developing Solutions with Azure DocumentDB
Developing Solutions with Azure DocumentDB Developing Solutions with Azure DocumentDB
Developing Solutions with Azure DocumentDB
 
Microsoft Azure DocumentDB - Global Azure Bootcamp 2016
Microsoft Azure DocumentDB -  Global Azure Bootcamp 2016Microsoft Azure DocumentDB -  Global Azure Bootcamp 2016
Microsoft Azure DocumentDB - Global Azure Bootcamp 2016
 
Microsoft azure documentDB
Microsoft azure documentDBMicrosoft azure documentDB
Microsoft azure documentDB
 
Introduction to Azure DocumentDB
Introduction to Azure DocumentDBIntroduction to Azure DocumentDB
Introduction to Azure DocumentDB
 
Azure DocumentDB Overview
Azure DocumentDB OverviewAzure DocumentDB Overview
Azure DocumentDB Overview
 
Azure DocumentDB
Azure DocumentDBAzure DocumentDB
Azure DocumentDB
 
Data Modeling for NoSQL
Data Modeling for NoSQLData Modeling for NoSQL
Data Modeling for NoSQL
 
5 Data Modeling for NoSQL 1/2
5 Data Modeling for NoSQL 1/25 Data Modeling for NoSQL 1/2
5 Data Modeling for NoSQL 1/2
 
Introducing DocumentDB
Introducing DocumentDB Introducing DocumentDB
Introducing DocumentDB
 
NoSQL Now! NoSQL Architecture Patterns
NoSQL Now! NoSQL Architecture PatternsNoSQL Now! NoSQL Architecture Patterns
NoSQL Now! NoSQL Architecture Patterns
 
Cassandra Data Modeling - Practical Considerations @ Netflix
Cassandra Data Modeling - Practical Considerations @ NetflixCassandra Data Modeling - Practical Considerations @ Netflix
Cassandra Data Modeling - Practical Considerations @ Netflix
 

Similar a Modeling JSON data for NoSQL document databases

Schema Design
Schema DesignSchema Design
Schema DesignMongoDB
 
Schema design mongo_boston
Schema design mongo_bostonSchema design mongo_boston
Schema design mongo_bostonMongoDB
 
Schema & Design
Schema & DesignSchema & Design
Schema & DesignMongoDB
 
Webinar: Schema Design
Webinar: Schema DesignWebinar: Schema Design
Webinar: Schema DesignMongoDB
 
Schema Design
Schema DesignSchema Design
Schema DesignMongoDB
 
10gen Presents Schema Design and Data Modeling
10gen Presents Schema Design and Data Modeling10gen Presents Schema Design and Data Modeling
10gen Presents Schema Design and Data ModelingDATAVERSITY
 
Schema design
Schema designSchema design
Schema designchristkv
 
CouchDB at New York PHP
CouchDB at New York PHPCouchDB at New York PHP
CouchDB at New York PHPBradley Holt
 
Aggregation Framework MongoDB Days Munich
Aggregation Framework MongoDB Days MunichAggregation Framework MongoDB Days Munich
Aggregation Framework MongoDB Days MunichNorberto Leite
 
MongoDB Schema Design
MongoDB Schema DesignMongoDB Schema Design
MongoDB Schema Designaaronheckmann
 
Managing Social Content with MongoDB
Managing Social Content with MongoDBManaging Social Content with MongoDB
Managing Social Content with MongoDBMongoDB
 
Webinar: Schema Design
Webinar: Schema DesignWebinar: Schema Design
Webinar: Schema DesignMongoDB
 
Webinar: Back to Basics: Thinking in Documents
Webinar: Back to Basics: Thinking in DocumentsWebinar: Back to Basics: Thinking in Documents
Webinar: Back to Basics: Thinking in DocumentsMongoDB
 
Azure DocumentDB: Advanced Features for Large Scale-Apps
Azure DocumentDB: Advanced Features for Large Scale-AppsAzure DocumentDB: Advanced Features for Large Scale-Apps
Azure DocumentDB: Advanced Features for Large Scale-AppsAndrew Liu
 
Inferring Versioned Schemas from NoSQL Databases and its Applications
Inferring Versioned Schemas from NoSQL Databases and its ApplicationsInferring Versioned Schemas from NoSQL Databases and its Applications
Inferring Versioned Schemas from NoSQL Databases and its ApplicationsDiego Sevilla Ruiz
 
Schema Design
Schema DesignSchema Design
Schema DesignMongoDB
 
Introducing Azure DocumentDB - NoSQL, No Problem
Introducing Azure DocumentDB - NoSQL, No ProblemIntroducing Azure DocumentDB - NoSQL, No Problem
Introducing Azure DocumentDB - NoSQL, No ProblemAndrew Liu
 
Baton rouge - sql vs no sql and azure data factory
Baton rouge - sql vs no sql and azure data factoryBaton rouge - sql vs no sql and azure data factory
Baton rouge - sql vs no sql and azure data factoryDiponkar Paul
 
SQL vs. NoSQL and Moving data by Azure Data Factory
SQL vs. NoSQL and Moving data by Azure Data FactorySQL vs. NoSQL and Moving data by Azure Data Factory
SQL vs. NoSQL and Moving data by Azure Data FactoryDiponkar Paul
 

Similar a Modeling JSON data for NoSQL document databases (20)

Schema Design
Schema DesignSchema Design
Schema Design
 
Schema design mongo_boston
Schema design mongo_bostonSchema design mongo_boston
Schema design mongo_boston
 
Schema & Design
Schema & DesignSchema & Design
Schema & Design
 
Webinar: Schema Design
Webinar: Schema DesignWebinar: Schema Design
Webinar: Schema Design
 
Schema Design
Schema DesignSchema Design
Schema Design
 
10gen Presents Schema Design and Data Modeling
10gen Presents Schema Design and Data Modeling10gen Presents Schema Design and Data Modeling
10gen Presents Schema Design and Data Modeling
 
Schema design
Schema designSchema design
Schema design
 
CouchDB at New York PHP
CouchDB at New York PHPCouchDB at New York PHP
CouchDB at New York PHP
 
Aggregation Framework MongoDB Days Munich
Aggregation Framework MongoDB Days MunichAggregation Framework MongoDB Days Munich
Aggregation Framework MongoDB Days Munich
 
MongoDB Schema Design
MongoDB Schema DesignMongoDB Schema Design
MongoDB Schema Design
 
Managing Social Content with MongoDB
Managing Social Content with MongoDBManaging Social Content with MongoDB
Managing Social Content with MongoDB
 
Webinar: Schema Design
Webinar: Schema DesignWebinar: Schema Design
Webinar: Schema Design
 
Webinar: Back to Basics: Thinking in Documents
Webinar: Back to Basics: Thinking in DocumentsWebinar: Back to Basics: Thinking in Documents
Webinar: Back to Basics: Thinking in Documents
 
Azure DocumentDB: Advanced Features for Large Scale-Apps
Azure DocumentDB: Advanced Features for Large Scale-AppsAzure DocumentDB: Advanced Features for Large Scale-Apps
Azure DocumentDB: Advanced Features for Large Scale-Apps
 
Inferring Versioned Schemas from NoSQL Databases and its Applications
Inferring Versioned Schemas from NoSQL Databases and its ApplicationsInferring Versioned Schemas from NoSQL Databases and its Applications
Inferring Versioned Schemas from NoSQL Databases and its Applications
 
Schema Design
Schema DesignSchema Design
Schema Design
 
Introducing Azure DocumentDB - NoSQL, No Problem
Introducing Azure DocumentDB - NoSQL, No ProblemIntroducing Azure DocumentDB - NoSQL, No Problem
Introducing Azure DocumentDB - NoSQL, No Problem
 
NoSQL databases
NoSQL databasesNoSQL databases
NoSQL databases
 
Baton rouge - sql vs no sql and azure data factory
Baton rouge - sql vs no sql and azure data factoryBaton rouge - sql vs no sql and azure data factory
Baton rouge - sql vs no sql and azure data factory
 
SQL vs. NoSQL and Moving data by Azure Data Factory
SQL vs. NoSQL and Moving data by Azure Data FactorySQL vs. NoSQL and Moving data by Azure Data Factory
SQL vs. NoSQL and Moving data by Azure Data Factory
 

Último

W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...panagenda
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...OnePlan Solutions
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVshikhaohhpro
 
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AISyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AIABDERRAOUF MEHENNI
 
Active Directory Penetration Testing, cionsystems.com.pdf
Active Directory Penetration Testing, cionsystems.com.pdfActive Directory Penetration Testing, cionsystems.com.pdf
Active Directory Penetration Testing, cionsystems.com.pdfCionsystems
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providermohitmore19
 
Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantAxelRicardoTrocheRiq
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...MyIntelliSource, Inc.
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerThousandEyes
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Modelsaagamshah0812
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxbodapatigopi8531
 
DNT_Corporate presentation know about us
DNT_Corporate presentation know about usDNT_Corporate presentation know about us
DNT_Corporate presentation know about usDynamic Netsoft
 
Professional Resume Template for Software Developers
Professional Resume Template for Software DevelopersProfessional Resume Template for Software Developers
Professional Resume Template for Software DevelopersVinodh Ram
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionSolGuruz
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsArshad QA
 
Clustering techniques data mining book ....
Clustering techniques data mining book ....Clustering techniques data mining book ....
Clustering techniques data mining book ....ShaimaaMohamedGalal
 
why an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfwhy an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfjoe51371421
 

Último (20)

W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
 
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS LiveVip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTV
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
 
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AISyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
 
Active Directory Penetration Testing, cionsystems.com.pdf
Active Directory Penetration Testing, cionsystems.com.pdfActive Directory Penetration Testing, cionsystems.com.pdf
Active Directory Penetration Testing, cionsystems.com.pdf
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
 
Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service Consultant
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
 
Exploring iOS App Development: Simplifying the Process
Exploring iOS App Development: Simplifying the ProcessExploring iOS App Development: Simplifying the Process
Exploring iOS App Development: Simplifying the Process
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Models
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptx
 
DNT_Corporate presentation know about us
DNT_Corporate presentation know about usDNT_Corporate presentation know about us
DNT_Corporate presentation know about us
 
Professional Resume Template for Software Developers
Professional Resume Template for Software DevelopersProfessional Resume Template for Software Developers
Professional Resume Template for Software Developers
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with Precision
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview Questions
 
Clustering techniques data mining book ....
Clustering techniques data mining book ....Clustering techniques data mining book ....
Clustering techniques data mining book ....
 
why an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfwhy an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdf
 

Modeling JSON data for NoSQL document databases

  • 1. Modeling JSON data for document databases Ryan CrawCour Program Manager, Microsoft @ryancrawcour David Makogon Cloud Architect, Microsoft @dmakogon
  • 2. Today’s talk • What are document databases? • What is Azure DocumentDB? • Modeling data for a document database Loud applause and lots of great tweets about #DocumentDB @ #CloudDevelop !
  • 3. Kinds of databases • Relational • Column • Key Value • Graph • Document
  • 5. Document Databases • Part of NoSQL family • Built for simplicity • Built for scale and performance • Non-relational • No enforced schema { "name": "SmugMug", "permalink": "smugmug", "homepage_url": "http://www.smugmug.com", "blog_url": "http://blogs.smugmug.com/", "category_code": "photo_video", "products": [ { "name": "SmugMug", "permalink": "smugmug" } ], "offices": [ { "description": "", "address1": "67 E. Even Ave, Suite 200", "address2": "", "zip_code": "94041", "city": "Mountain View", "state_code": "CA", "country_code": "USA", "latitude": 37.390056, "longitude": -122.067692 } ] }
  • 6. Document Databases { “id": “itemdata2344", “data": “TWFuIGlzIGRpc3Rpbmd1aXNoZWQsIG5vd cyByZWFzb24sIGJ1dCBieSB0aGlzHNpbmd1bG nJvbSBvdGhlciBhbmltYWxzLCB3aGljaCBpcyYg dGhlIG1pbmQsIHRoYXQgYnkgYSBwZXJzZXZlsaW dodCBpbiB0aGUgY29udGludWVkIGFuZCBpbGdl bmVyYXRpb24gb2Yga25vd2xlZGdlLCBleGNlZ9y dCB2ZWhlbWVuY2Ugb2YgYW55IGNhcm5hS4= cyByZWFzb24sIGJ1dCBieSB0aGlzHNpbmd1bGFyIZ nJvbSBvdGhlciBhbmltYWxzLCB3aGljaCBpcyBh2Yg dGhlIG1pbmQsIHRoYXQgYnkgYSBwZXJzZXZlGVsaW dodCBpbiB0aGUgY29udGludWVkIGFuZCBpbmRlZGdl bmVyYXRpb24gb2Yga25vd2xlZGdlLCBleGNlZWG9y dCB2ZWhlbWVuY2Ugb2YgYW55IGNhcm5hbS4= cyByZWFzb24sIGJ1dCBieSB0aGlzHNpbmd1bGF4gZ nJvbSBvdGhlciBhbmltYWxzLCB3aGljaCBpg dGhlIG1pbmQsIHRoYXQgYnkgYSBwZXJzZXZlcmVsaW dodCBpbiB0aGUgY29udGludWVkIGFuZCBpbmRlIGdl bmVyYXRpb24gb2Yga25vd2xlZGdlLCBleGNlZzaG9y dCB2ZWhlbWVuY2Ugb2YgYW55IGNhcm5hbCBwZS4=” } • Part of NoSQL family • Built for simplicity • Built for scale and performance • Non-relational • No enforced schema
  • 7. Document Databases • Part of NoSQL family • Built for simplicity • Built for scale and performance • Non-relational • No enforced schema
  • 8. Azure DocumentDB: Lightning Round Edition { name:"Azure DocumentDB", deployedAs: "Service", dbType: "Document", connectVia: [ "rest", "sdk" ], deployVia: [ "portal", "rest", "cli", "sdk" ], scaleVia: [ "portal", "rest", "cli", "sdk" ], differsVia: [ "js", "indexing", "consistency" ] }
  • 9. Modeling JSON data in this brave "new" world
  • 10. Modeling data, the relational way
  • 11. Come as you are Data normalization How do approaches differ?
  • 12. To embed, or to reference, that is the question embed reference
  • 13. To embed, or to reference, that is the question • Data from entities are queried together
  • 14. To embed, or to reference, that is the question • Data from entities are queried together
  • 15. To embed, or to reference, that is the question • Data from entities are queried together { id: "book1", covers: [ {type: "front", artworkUrl: "http://..."}, {type: "back", artworkUrl: "http://..."} ] index: "", chapters: [ {id: 1, synopsis: "", quote: "", pageCount:24, wordCount:456}, {id: 1, synopsis: "", quote: "", pageCount:24, wordCount:456}, ] }
  • 16. To embed, or to reference, that is the question • Data from entities are queried together • The child is a dependent e.g. Order Line depends on Order { id: "order1", customer: "customer1", orderDate: "2014-09-15T23:14:25.7251173Z" lines: [ {product: "13inch screen" , price: 200.00, qty: 50 }, {product: "Keyboard", price:23.67, qty:4} {product: "CPU", price:87.89, qty:1 ] }
  • 17. To embed, or to reference, that is the question • Data from entities are queried together • The child is a dependent e.g. Order Line depends on Order • 1:1 relationship { id: "person1", name: "Mickey" creditCard: { number: "**** **** **** 4794"}, expiry: "06/2019"}, cvv: "868", type: "Mastercard" } }
  • 18. To embed, or to reference, that is the question • Data from entities are queried together • The child is a dependent e.g. Order Line depends on Order • 1:1 relationship • Similar volatility { id: "person1", name: "Mickey", contactInfo: [ {email: "mickey@disney.com"}, {mobile: "+1 555-5555"}, {twitter: "@MickeyMouse"} ] }
  • 19. To embed, or to reference, that is the question • Data from entities are queried together • The child is a dependent e.g. Order Line depends on Order • 1:1 relationship • Similar volatility • The set of values or sub-documents is bounded (1:few) { id: "task1", desc: "deliver an awesome presentation @ #CloudDevelop", categories: ["conference", "talk", "workshop", "business"] }
  • 20. To embed, or to reference, that is the question • Data from entities are queried together • The child is a dependent e.g. Order Line depends on Order • 1:1 relationship • Similar volatility • The set of values or sub-documents is bounded (1:few) Typically denormalized data models provide better read performance
  • 21. To embed, or to reference, that is the question • one-to-many relationships (unbounded) { id: "post1", author: "Mickey Mouse", tags: [ "fun", "cloud", "develop"] } {id: "c1", postId: "post1", comment: "Coolest blog post"} {id: "c2", postId: "post1", comment: "Loved this post, awesome"} {id: "c3", postId: "post1", comment: "This is rad!"} … {id: "c10000", postId: "post1", comment: "You are the coolest cartoon character"} … {id: "c2000000", postId: "post1", comment: "Are we still commeting on this blog?"}
  • 22. To embed, or to reference, that is the question • one-to-many relationships (unbounded) • many-to-many relationships { id: "book1", name: "100 Secrets of Disneyland" } { id: "book2", name: "The best places to eat @ Disney" } { author-id: "author1", book-id: "book1" } { author-id: "author2", book-id: "book1" } { id: "author1", name: "Mickey Mouse" } { id: "author2", name: "Donald Duck" } Look familiar? It should …. It's the "relational" way
  • 23. To embed, or to reference, that is the question • one-to-many relationships (unbounded) • many-to-many relationships { id: "book1", name: "100 Secrets of Disneyland", authors: ["author1", "author2"] } { id: "book2", name: "The best places to eat @ Disney”, authors: ["author1"] } { id: "author1", name: "Mickey Mouse", books: ["book1", "book2"] } { id: "author2", name: "Donald Duck" books: ["book1"] }
  • 24. To embed, or to reference, that is the question • one-to-many relationships (unbounded) • many-to-many relationships • Related data changes frequently • The referenced entity is a key entity used by many others { id: "person1", author: "Mickey Mouse", stocks: [ "dis", "msft", "nflx"] } { id: "dis", opening: "52.09", numerOfTrades: 10000, trades: [{time: 083745, qty:57, price: 53.97}, {time: 083746, qty:5, price: 54.01}] }
  • 25. To embed, or to reference, that is the question • one-to-many relationships (unbounded) • many-to-many relationships • Related data changes frequently • The referenced entity is a key entity used by many others Normalized data models can require more round trips to the server. Typically normalizing provides better write performance.
  • 26. Where do you put the reference? Publisher & Book … does publisher refer to book? Publisher document: { id: "mspress", name: "Microsoft Press", books: [ 1, 2, 3, ..., 100, ..., 1000] } Book documents: {id: 1, name: "DocumentDB 101" } {id: 2, name: "DocumentDB for RDBMS Users" } {id: 3, name: "Taking over the world one JSON doc at a time" }
  • 27. Where do you put the reference? Publisher & Book … does or book refer to publisher? Publisher document: { id: "mspress", name: "Microsoft Press", books: [ 1, 2, 3, ..., 100, ..., 1000] } Book documents: {id: 1, name: "DocumentDB 101", pub-id: "mspress"} {id: 2, name: "DocumentDB for RDBMS Users", pub-id: "mspress"} {id: 3, name: "Taking over the world one JSON doc at a time", pub-id: "mspress"}
  • 28. Is it always black or white?
  • 29. Is it always black or white?
  • 30. Is it always black or white? { id: 1, firstName: "Mickey", lastName: "Mouse", books: [1, 2, 3], images: [ {"thumbnail": "http://....png"}, {"profile": "http://....png"}, ], bio: "Mickey Mouse is a funny animal cartoon character and the official mascot of The Walt Disney Company. An anthropomorphic mouse who typically wears red shorts, large yellow shoes, and white gloves, Mickey has become one of the most recognizable cartoon characters." } { id: 1, name: "DocumentDB 101", authors": [ { id: 1, name: "Mickey Mouse", bio: "Mickey Mouse is a funny animal cartoon character and the official mascot of The Walt Disney Company…", thumbnailUrl: "http://....png" } ] }
  • 31. How to model hierarchical trees? Jill Ben Susan SvenAndrew Thomas { { id: "Jill" }, { id: "Ben", manager: "Jill" }, { id: "Susan", manager: "Jill" }, { id: "Andrew", manager: "Ben" }, { id: "Sven", manager: "Susan" }, { id: "Thomas", manager: "Sven" } } SELECT manager FROM org WHERE id = "Susan" To get the manager of any employee is trivial -
  • 32. How to model hierarchical trees? Jill Ben Susan SvenAndrew Thomas { { id: "Jill" }, { id: "Ben", manager: "Jill" }, { id: "Susan", manager: "Jill" }, { id: "Andrew", manager: "Ben" }, { id: "Sven", manager: "Susan" }, { id: "Thomas", manager: "Sven" } } SELECT * FROM org WHERE manager = "Jill" To get all employees where Jill is the manager is also easy -
  • 33. How to model hierarchical trees? Jill Ben Susan SvenAndrew Thomas { { id: "Jill", directs: ["Ben", "Susan"] }, { id: "Ben", directs: ["Andrew"] }, { id: "Susan", directs: ["Sven"] }, { id: "Andrew" }, { id: "Sven", directs: ["Thomas"] }, { id: "Thomas" } } SELECT * FROM org WHERE id = "Jill" To get all direct reports for Jill is easy -
  • 34. How to model hierarchical trees? Jill Ben Susan SvenAndrew Thomas { { id: "Jill", directs: ["Ben", "Susan"] }, { id: "Ben", directs: ["Andrew"] }, { id: "Susan", directs: ["Sven"] }, { id: "Andrew" }, { id: "Sven", directs: ["Thomas"] }, { id: "Thomas" } } SELECT * FROM emp WHERE ARRAY_CONTAINS(emp.directs, "Ben") To find the manager for an employee is possible -
  • 35. How to support keyword search? { id: "CDC101", title: "Fundamentals of database design", credits: 10 } }
  • 36. How to support keyword search? { id: "CDC101", title: “The Fundamentals of Database Design", titleWords: [ "fundamentals", "database", "design", "database design" ], credits: 10 } Consider using a RegEx to transform words to lowercase and remove any punctuation. Strip out stop words like “to”, “the”, “of” etc. Denormalize keywords in to key phrases
  • 38. { options: ["Embed", "Reference"], rules: "There are no rules, merely guidelines", embed: [ "1:1", "Child is a dependent", "Similar volatility", "favor read speed" ] reference: [ "related data changes frequently", "many:many", "favor writes" ] remember: [ "Don't be scared to experiment and mix & match", "Models change & evolve", "Hybrid models" ] } Summary
  • 39. Azure DocumentDB SDKs and Tooling SDKs aka.ms/docdbsdks Azure Portal portal.azure.com Studio aka.ms/docdbstudio
  • 40. Get Started Today explore playground select * from playground p where p.name = "DocumentDB" aka.ms/docdbplayground build an app aka.ms/docdbstarter move some data aka.ms/docdbimport
  • 41. http://aka.ms/CloudDevelop • Dell Venue Pro 8 • Enter by filling out survey • Announced at the end of the day. • Must be present to win.
  • 42. Wrapping up • documentdb.com • @DocumentDB • @dmakogon • @ryancrawcour

Notas del editor

  1. Jump to portal to show features
  2. Jump to portal to show features
  3. Jump to portal to show features
  4. instead of taking the business subject / domain entity and breaking it up into multiple relational structures store the business subject in the minimal number of documents.
  5. Add diagram showing the differences
  6. e.g. application for efficient data entry of product orders Order contains over 100 fields Order Line contains over 50 fields Product contains over 150 fields An order on avg contains 20 lines - Would you embed order lines on to order? Yes, Order Line is dependant on Order. Most of the time Order & Order line would be read together - Would you embed product on to order line? No. Perhaps, but maybe just the info from product we need. - What about requirement to support effecient data entry? Would having Order Line seperate be more effecient from a data entry point of view? - What about the number of Order Lines? 20 is not unbounded.
  7. e.g. application for efficient data entry of product orders Order contains over 100 fields Order Line contains over 50 fields Product contains over 150 fields An order on avg contains 20 lines - Would you embed order lines on to order? Yes, Order Line is dependant on Order. Most of the time Order & Order line would be read together - Would you embed product on to order line? No. Perhaps, but maybe just the info from product we need. - What about requirement to support effecient data entry? Would having Order Line seperate be more effecient from a data entry point of view? - What about the number of Order Lines? 20 is not unbounded.
  8. e.g. application for efficient data entry of product orders Order contains over 100 fields Order Line contains over 50 fields Product contains over 150 fields An order on avg contains 20 lines - Would you embed order lines on to order? Yes, Order Line is dependant on Order. Most of the time Order & Order line would be read together - Would you embed product on to order line? No. Perhaps, but maybe just the info from product we need. - What about requirement to support effecient data entry? Would having Order Line seperate be more effecient from a data entry point of view? - What about the number of Order Lines? 20 is not unbounded.
  9. e.g. application for efficient data entry of product orders Order contains over 100 fields Order Line contains over 50 fields Product contains over 150 fields An order on avg contains 20 lines - Would you embed order lines on to order? Yes, Order Line is dependant on Order. Most of the time Order & Order line would be read together - Would you embed product on to order line? No. Perhaps, but maybe just the info from product we need. - What about requirement to support effecient data entry? Would having Order Line seperate be more effecient from a data entry point of view? - What about the number of Order Lines? 20 is not unbounded.
  10. e.g. application for efficient data entry of product orders Order contains over 100 fields Order Line contains over 50 fields Product contains over 150 fields An order on avg contains 20 lines - Would you embed order lines on to order? Yes, Order Line is dependant on Order. Most of the time Order & Order line would be read together - Would you embed product on to order line? No. Perhaps, but maybe just the info from product we need. - What about requirement to support effecient data entry? Would having Order Line seperate be more effecient from a data entry point of view? - What about the number of Order Lines? 20 is not unbounded.
  11. Denormalize some data and reference other data for a hybrid model Remember, model as your application is going to use it The danger of this is if the author changes their name or bio then you need to go update every book they have authored Luckily DocumentDB allows multi-document transactions so this would be possible to do in a single atomic transaction Similarly if the author changed their thumbnail picture you need to go update every book, or would you? You might want to keep the image of what the author looked like when a particular book was published. So here denormalizing is actually useful, because you get a snapshot in time unlike pure referencing
  12. Denormalize some data and reference other data for a hybrid model Remember, model as your application is going to use it The danger of this is if the author changes their name or bio then you need to go update every book they have authored Luckily DocumentDB allows multi-document transactions so this would be possible to do in a single atomic transaction Similarly if the author changed their thumbnail picture you need to go update every book, or would you? You might want to keep the image of what the author looked like when a particular book was published. So here denormalizing is actually useful, because you get a snapshot in time unlike pure referencing
  13. Denormalize some data and reference other data for a hybrid model Remember, model as your application is going to use it The danger of this is if the author changes their name or bio then you need to go update every book they have authored Luckily DocumentDB allows multi-document transactions so this would be possible to do in a single atomic transaction Similarly if the author changed their thumbnail picture you need to go update every book, or would you? You might want to keep the image of what the author looked like when a particular book was published. So here denormalizing is actually useful, because you get a snapshot in time unlike pure referencing
  14. DocumentDB offers SDKs and tooling to help you develop against and manage data in the service. All APIs are accessible as REST over HTTP, we also provide .Net, Node, Java and Python SDKs I already shown provisioning through the portal – the Azure Preview portal offers a variety of development, monitoring and management capabilities. DocumentDB Studio is an open source app that allows you to manage and interact with the service from a GUI tool The Data Migration tool allows you import existing data into DocumentDB