SlideShare ist ein Scribd-Unternehmen logo
1 von 46
Schema Design
Buzz Moschetti
Enterprise Architect, MongoDB
buzz.moschetti@mongodb.com
@buzzmoschetti
2
Before We Begin
• This webinar is being recorded
• Use The Chat Window for
• Technical assistance
• Q&A
• MongoDB Team will answer questions
• Common questions will be reviewed at the
end of the webinar
Theme #1:
Great Schema Design involves
much more than the database
• Easily understood structures
• Harmonized with software
• Acknowledging legacy issues
Theme #2:
Today’s solutions need to
accommodate tomorrow’s needs
• End of “Requirements Complete”
• Ability to economically scale
• Shorter solutions lifecycles
Theme #3:
MongoDB offers you choice
RDBMS MongoDB
Database Database
Table Collection
Index Index
Row Document
Join Embedding & Linking
Terminology
{
_id: “123”,
title: "MongoDB: The Definitive Guide",
authors: [
{ _id: "kchodorow", name: "Kristina Chodorow“ },
{ _id: "mdirold", name: “Mike Dirolf“ }
],
published_date: ISODate("2010-09-24"),
pages: 216,
language: "English",
thumbnail: BinData(0,"AREhMQ=="),
publisher: {
name: "O’Reilly Media",
founded: 1980,
locations: ["CA”, ”NY” ]
}
}
What is a Document?
// Java: maps
DBObject query = new BasicDBObject(”publisher.founded”, 1980));
Map m = collection.findOne(query);
Date pubDate = (Date)m.get(”published_date”); // java.util.Date
// Javascript: objects
m = collection.findOne({”publisher.founded” : 1980});
pubDate = m.published_date; // ISODate
year = pubDate.getUTCFullYear();
# Python: dictionaries
m = coll.find_one({”publisher.founded” : 1980 });
pubDate = m[”pubDate”].year # datetime.datetime
Documents Map to Language Constructs
9
Traditional Schema Design
• Static, Uniform Scalar Data
• Rectangles
• Low-level, physical
representation
10
Document Schema Design
• Flexible, Rich Shapes
• Objects
• Higher-level, business
representation
Schema Design By
Example
12
Library Management Application
• Patrons/Users
• Books
• Authors
• Publishers
13
Question:
What is a Patron’s Address?
A Patron and their Address
> patron = db.patrons.find({ _id : “joe” })
{
_id: "joe“,
name: "Joe Bookreader”,
favoriteGenres: [ ”mystery”, ”programming” ]
}
> address = db.addresses.find({ _id : “joe” })
{
_id: "joe“,
street: "123 Fake St.",
city: "Faketon",
state: "MA",
zip: 12345
}
A Patron and their Address
> patron = db.patrons.find({ _id : “joe” })
{
_id: "joe",
name: "Joe Bookreader",
favoriteGenres: [ ”mystery”, ”programming” ]
address: {
street: "123 Fake St. ",
city: "Faketon",
state: "MA",
zip: 12345
}
}
Projection: Return only what you need
> patron = db.patrons.find({ _id : “joe” },
{“_id”: 0, ”address”:1})
{
address: {
street: "123 Fake St. ",
city: "Faketon",
state: "MA",
zip: 12345
}
}
> patron = db.patrons.find({ _id : “joe” },
{“_id”: 0, “name”:1, ”address.state”:1})
{
name: "Joe Bookreader",
address: {
state: "MA”
}
}
17
One-to-One Relationships
• “Belongs to” relationships are often embedded
• Holistic representation of entities with their
embedded attributes and relationships.
• Great read performance
Most important:
• Keeps simple things simple
• Frees up time to tackle harder schema
design issues
18
Question:
What are a Patron’s Addresses?
A Patron and their Addresses
> patron = db.patrons.find({ _id : “bob” })
{
_id: “bob",
name: “Bob Knowitall",
addresses: [
{street: "1 Vernon St.", city: "Newton", …},
{street: "52 Main St.", city: "Boston", …}
]
}
A Patron and their Addresses
> patron = db.patrons.find({ _id : “bob” })
{
_id: “bob",
name: “Bob Knowitall",
addresses: [
{street: "1 Vernon St.", city: "Newton", …},
{street: "52 Main St.", city: "Boston", …}
]
}
> patron = db.patrons.find({ _id : “joe” })
{
_id: "joe",
name: "Joe Bookreader",
address: { street: "123 Fake St. ", city: "Faketon", …}
}
21
Migration Options
• Migrate all documents when the schema changes.
• Migrate On-Demand
– As we pull up a patron’s document, we make the
change.
– Any patrons that never come into the library never get
updated.
• Leave it alone
– The code layer knows about both address and
addresses
22
The Utility of Substructure
Map d = collection.find(new BasicDBObject(”_id”,”Bob”));
Map addr = (Map) d.get(”address”);
If(addr == null) {
List<Map> addrl = (List) d.get(”addresses”);
addr = addrl.get(0);
}
doSomethingWithOneAddress(addr);
/**
If later we add “region” to the address substructure, none
of the queries have to change! Another value will appear
in the Map (or not -- and that can be interrogated) and be
processed.
**/
23
Question:
Who is the publisher of this
book?
24
Book
• MongoDB: The Definitive Guide,
• By Kristina Chodorow and Mike Dirolf
• Published: 9/24/2010
• Pages: 216
• Language: English
• Publisher: O’Reilly Media, CA
Book with embedded Publisher
> book = db.books.find({ _id : “123” })
{
_id: “123”,
title: "MongoDB: The Definitive Guide",
authors: [ "Kristina Chodorow", "Mike Dirolf" ],
published_date: ISODate("2010-09-24"),
pages: 216,
language: "English",
publisher: {
name: "O’Reilly Media",
founded: 1980,
locations: ["CA”, ”NY” ]
}
}
Don’t Forget the Substructure!
> book = db.books.find({ _id : “123” })
{
_id: “123”,
title: "MongoDB: The Definitive Guide",
authors: [
{ first: "Kristina”, last: “Chodorow” },
{ first: ”Mike”, last: “Dirolf” }
],
published_date: ISODate("2010-09-24"),
pages: 216,
language: "English",
publisher: {
name: "O’Reilly Media",
founded: 1980,
locations: ["CA”, ”NY” ]
}
}
27
Book with embedded Publisher
• Optimized for read performance of Books
• We accept data duplication
• An index on “publisher.name” provides:
– Efficient lookup of all books for given publisher name
– Efficient way to find all publisher names (distinct)
Publishers as a Separate Entity
> publishers = db.publishers.find()
{
_id: “oreilly”,
name: "O’Reilly Media",
founded: 1980,
locations: ["CA”, ”NY” ]
}
{
_id: “penguin”,
name: “Penguin”,
founded: 1983,
locations: [ ”IL” ]
}
Book with Linked Publisher
> book = db.books.find({ _id: “123” })
{
_id: “123”,
publisher_id: “oreilly”,
title: "MongoDB: The Definitive Guide",
…
}
> db.publishers.find({ _id : book.publisher_id })
{
_id: “oreilly”,
name: "O’Reilly Media",
founded: 1980,
locations: ["CA”, ”NY” ]
}
Books with Linked Publisher
db.books.find({ criteria } ).forEach(function(r) {
m[r.publisher.name] = 1; // Capture publisher ID
});
uniqueIDs = Object.keys(m);
cursor = db.publishers.find({"_id": {"$in": uniqueIDs } });
31
Question:
What are all the books a
publisher has published?
Publisher with linked Books
> publisher = db.publishers.find({ _id : “oreilly” })
{
_id: “oreilly”,
name: "O’Reilly Media",
founded: 1980,
locations: [ "CA“, ”NY” ],
books: [“123”, “456”, “789”, “10112”, …]
}
> books = db.books.find({ _id: { $in : publisher.books } })
33
Question:
Who are the authors of a given
book?
Books with linked Authors
> book = db.books.find({ _id : “123” })
{
_id: “123”,
title: "MongoDB: The Definitive Guide",
…
authors: [
{ _id: “X12”, first: "Kristina”, last: “Chodorow” },
{ _id: “Y45”, first: ”Mike”, last: “Dirolf” }
],
}
> a2 = book.authors.map(function(r) { return r._id; });
> authors = db.authors.find({ _id : { $in : a2}})
{_id:”X12”,name:{first:"Kristina”,last:”Chodorow”},hometown: …
}
{_id:“Y45”,name:{first:”Mike”,last:”Dirolf”}, hometown: … }
35
Question:
What are all the books an author
has written?
> authors = db.authors.find({ _id : “X12” })
{
_id: ”X12",
name: { first: "Kristina”, last: “Chodorow” } ,
hometown: "Cincinnati",
books: [ {id: “123”, title : "MongoDB: The Definitive
Guide“ } ]
}
> book = db.books.find({ _id : “123” })
{
_id: “123”,
title: "MongoDB: The Definitive Guide",
…
authors: [
{ _id: “X12”, first: "Kristina”, last: “Chodorow” },
{ _id: “Y45”, first: ”Mike”, last: “Dirolf” }
],
}
Double Link Books and Authors
> book = db.books.find({ _id : “123” })
{
authors: [
{ _id: “X12”, first: "Kristina”, last: “Chodorow” },
{ _id: “Y45”, first: ”Mike”, last: “Dirolf” }
],
}
> db.books.ensureIndex({“authors._id”: 1});
> db.books.find({ “authors._id” : “X12” }).explain();
{
"cursor" : "BtreeCursor authors.id_1",
…
"millis" : 0,
}
…or Use Indexes
38
Embedding vs. Linking
• Embedding
– Terrific for read performance
• Webapp “front pages” and pre-aggregated material
• Complex structures
– Inserts might be slower than linking
– Data integrity needs to be managed
• Linking
– Flexible
– Data integrity is built-in
– Work is done during reads
• But not necessarily more work than RDBMS
39
Question:
What are the personalized
attributes for each author?
> db.authors.find()
{
_id: ”X12",
name: { first: "Kristina”, last: “Chodorow” },
personalData: {
favoritePets: [ “bird”, “dog” ],
awards: [ {name: “Hugo”, when: 1983}, {name: “SSFX”,
when: 1992} ]
}
}
{
_id: ”Y45",
name: { first: ”Mike”, last: “Dirolf” } ,
personalData: {
dob: ISODate(“1970-04-05”)
}
}
Assign Dynamic Structure to a Known Name
> db.events.find()
{ type: ”click", ts: ISODate(“2015-03-03T12:34:56.789Z”,
data: { x: 123, y: 625, adId: “AE23A” } }
{ type: ”click", ts: ISODate(“2015-03-03T12:35:01.003Z”,
data: { x: 456, y: 611, adId: “FA213” } }
{ type: ”view", ts: ISODate(“2015-03-03T12:35:04.102Z”,
data: { scn: 2, reset: false, … } }
{ type: ”click", ts: ISODate(“2015-03-03T12:35:05.312Z”,
data: { x: 23, y: 32, adId: “BB512” } }
{ type: ”close", ts: ISODate(“2015-03-03T12:35:08.774Z”,
data: { snc: 2, … } }
{ type: ”click", ts: ISODate(“2015-03-03T12:35:10.114Z”,
data: { x: 881, y: 913, adId: “F430” } }
Polymorphism: Worth an Extra Slide
42
Question:
What are all the books about
databases?
Categories as an Array
> book = db.books.find({ _id : “123” })
{
_id: “123”,
title: "MongoDB: The Definitive Guide",
categories: [“MongoDB”, “Databases”, “Programming”]
}
> db.books.find({ categories: “Databases” })
Categories as a Path
> book = db.books.find({ _id : “123” })
{
_id: “123”,
title: "MongoDB: The Definitive Guide",
category: “Programming/Databases/MongoDB”
}
> db.books.find({ category: ^Programming/Databases/* })
45
Summary
• Schema design is different in MongoDB
– But basic data design principles stay the same
• Focus on how an application accesses/manipulates data
• Seek out and capture belongs-to 1:1 relationships
• Use substructure to better align to code objects
• Be polymorphic!
• Evolve the schema to meet requirements as they change
Questions & Answers

Weitere ähnliche Inhalte

Was ist angesagt?

MongoDB Schema Design: Four Real-World Examples
MongoDB Schema Design: Four Real-World ExamplesMongoDB Schema Design: Four Real-World Examples
MongoDB Schema Design: Four Real-World ExamplesMike Friedman
 
Building a Scalable Inbox System with MongoDB and Java
Building a Scalable Inbox System with MongoDB and JavaBuilding a Scalable Inbox System with MongoDB and Java
Building a Scalable Inbox System with MongoDB and Javaantoinegirbal
 
Back to Basics 1: Thinking in documents
Back to Basics 1: Thinking in documentsBack to Basics 1: Thinking in documents
Back to Basics 1: Thinking in documentsMongoDB
 
Schema Design by Example ~ MongoSF 2012
Schema Design by Example ~ MongoSF 2012Schema Design by Example ~ MongoSF 2012
Schema Design by Example ~ MongoSF 2012hungarianhc
 
Data Modeling for the Real World
Data Modeling for the Real WorldData Modeling for the Real World
Data Modeling for the Real WorldMike Friedman
 
Building your first app with mongo db
Building your first app with mongo dbBuilding your first app with mongo db
Building your first app with mongo dbMongoDB
 
MongoDB San Francisco 2013: Data Modeling Examples From the Real World presen...
MongoDB San Francisco 2013: Data Modeling Examples From the Real World presen...MongoDB San Francisco 2013: Data Modeling Examples From the Real World presen...
MongoDB San Francisco 2013: Data Modeling Examples From the Real World presen...MongoDB
 
The Fine Art of Schema Design in MongoDB: Dos and Don'ts
The Fine Art of Schema Design in MongoDB: Dos and Don'tsThe Fine Art of Schema Design in MongoDB: Dos and Don'ts
The Fine Art of Schema Design in MongoDB: Dos and Don'tsMatias Cascallares
 
Socialite, the Open Source Status Feed Part 2: Managing the Social Graph
Socialite, the Open Source Status Feed Part 2: Managing the Social GraphSocialite, the Open Source Status Feed Part 2: Managing the Social Graph
Socialite, the Open Source Status Feed Part 2: Managing the Social GraphMongoDB
 
Conceptos básicos. seminario web 3 : Diseño de esquema pensado para documentos
Conceptos básicos. seminario web 3 : Diseño de esquema pensado para documentosConceptos básicos. seminario web 3 : Diseño de esquema pensado para documentos
Conceptos básicos. seminario web 3 : Diseño de esquema pensado para documentosMongoDB
 
Back to Basics Webinar 4: Advanced Indexing, Text and Geospatial Indexes
Back to Basics Webinar 4: Advanced Indexing, Text and Geospatial IndexesBack to Basics Webinar 4: Advanced Indexing, Text and Geospatial Indexes
Back to Basics Webinar 4: Advanced Indexing, Text and Geospatial IndexesMongoDB
 
Agile Schema Design: An introduction to MongoDB
Agile Schema Design: An introduction to MongoDBAgile Schema Design: An introduction to MongoDB
Agile Schema Design: An introduction to MongoDBStennie Steneker
 
Managing Social Content with MongoDB
Managing Social Content with MongoDBManaging Social Content with MongoDB
Managing Social Content with MongoDBMongoDB
 
Modeling Data in MongoDB
Modeling Data in MongoDBModeling Data in MongoDB
Modeling Data in MongoDBlehresman
 
MongoDB Advanced Schema Design - Inboxes
MongoDB Advanced Schema Design - InboxesMongoDB Advanced Schema Design - Inboxes
MongoDB Advanced Schema Design - InboxesJared Rosoff
 
Back to Basics Webinar 2: Your First MongoDB Application
Back to Basics Webinar 2: Your First MongoDB ApplicationBack to Basics Webinar 2: Your First MongoDB Application
Back to Basics Webinar 2: Your First MongoDB ApplicationMongoDB
 
Socialite, the Open Source Status Feed
Socialite, the Open Source Status FeedSocialite, the Open Source Status Feed
Socialite, the Open Source Status FeedMongoDB
 
Building a Social Network with MongoDB
  Building a Social Network with MongoDB  Building a Social Network with MongoDB
Building a Social Network with MongoDBFred Chu
 
Socialite, the Open Source Status Feed Part 3: Scaling the Data Feed
Socialite, the Open Source Status Feed Part 3: Scaling the Data FeedSocialite, the Open Source Status Feed Part 3: Scaling the Data Feed
Socialite, the Open Source Status Feed Part 3: Scaling the Data FeedMongoDB
 
Conceptos básicos. Seminario web 4: Indexación avanzada, índices de texto y g...
Conceptos básicos. Seminario web 4: Indexación avanzada, índices de texto y g...Conceptos básicos. Seminario web 4: Indexación avanzada, índices de texto y g...
Conceptos básicos. Seminario web 4: Indexación avanzada, índices de texto y g...MongoDB
 

Was ist angesagt? (20)

MongoDB Schema Design: Four Real-World Examples
MongoDB Schema Design: Four Real-World ExamplesMongoDB Schema Design: Four Real-World Examples
MongoDB Schema Design: Four Real-World Examples
 
Building a Scalable Inbox System with MongoDB and Java
Building a Scalable Inbox System with MongoDB and JavaBuilding a Scalable Inbox System with MongoDB and Java
Building a Scalable Inbox System with MongoDB and Java
 
Back to Basics 1: Thinking in documents
Back to Basics 1: Thinking in documentsBack to Basics 1: Thinking in documents
Back to Basics 1: Thinking in documents
 
Schema Design by Example ~ MongoSF 2012
Schema Design by Example ~ MongoSF 2012Schema Design by Example ~ MongoSF 2012
Schema Design by Example ~ MongoSF 2012
 
Data Modeling for the Real World
Data Modeling for the Real WorldData Modeling for the Real World
Data Modeling for the Real World
 
Building your first app with mongo db
Building your first app with mongo dbBuilding your first app with mongo db
Building your first app with mongo db
 
MongoDB San Francisco 2013: Data Modeling Examples From the Real World presen...
MongoDB San Francisco 2013: Data Modeling Examples From the Real World presen...MongoDB San Francisco 2013: Data Modeling Examples From the Real World presen...
MongoDB San Francisco 2013: Data Modeling Examples From the Real World presen...
 
The Fine Art of Schema Design in MongoDB: Dos and Don'ts
The Fine Art of Schema Design in MongoDB: Dos and Don'tsThe Fine Art of Schema Design in MongoDB: Dos and Don'ts
The Fine Art of Schema Design in MongoDB: Dos and Don'ts
 
Socialite, the Open Source Status Feed Part 2: Managing the Social Graph
Socialite, the Open Source Status Feed Part 2: Managing the Social GraphSocialite, the Open Source Status Feed Part 2: Managing the Social Graph
Socialite, the Open Source Status Feed Part 2: Managing the Social Graph
 
Conceptos básicos. seminario web 3 : Diseño de esquema pensado para documentos
Conceptos básicos. seminario web 3 : Diseño de esquema pensado para documentosConceptos básicos. seminario web 3 : Diseño de esquema pensado para documentos
Conceptos básicos. seminario web 3 : Diseño de esquema pensado para documentos
 
Back to Basics Webinar 4: Advanced Indexing, Text and Geospatial Indexes
Back to Basics Webinar 4: Advanced Indexing, Text and Geospatial IndexesBack to Basics Webinar 4: Advanced Indexing, Text and Geospatial Indexes
Back to Basics Webinar 4: Advanced Indexing, Text and Geospatial Indexes
 
Agile Schema Design: An introduction to MongoDB
Agile Schema Design: An introduction to MongoDBAgile Schema Design: An introduction to MongoDB
Agile Schema Design: An introduction to MongoDB
 
Managing Social Content with MongoDB
Managing Social Content with MongoDBManaging Social Content with MongoDB
Managing Social Content with MongoDB
 
Modeling Data in MongoDB
Modeling Data in MongoDBModeling Data in MongoDB
Modeling Data in MongoDB
 
MongoDB Advanced Schema Design - Inboxes
MongoDB Advanced Schema Design - InboxesMongoDB Advanced Schema Design - Inboxes
MongoDB Advanced Schema Design - Inboxes
 
Back to Basics Webinar 2: Your First MongoDB Application
Back to Basics Webinar 2: Your First MongoDB ApplicationBack to Basics Webinar 2: Your First MongoDB Application
Back to Basics Webinar 2: Your First MongoDB Application
 
Socialite, the Open Source Status Feed
Socialite, the Open Source Status FeedSocialite, the Open Source Status Feed
Socialite, the Open Source Status Feed
 
Building a Social Network with MongoDB
  Building a Social Network with MongoDB  Building a Social Network with MongoDB
Building a Social Network with MongoDB
 
Socialite, the Open Source Status Feed Part 3: Scaling the Data Feed
Socialite, the Open Source Status Feed Part 3: Scaling the Data FeedSocialite, the Open Source Status Feed Part 3: Scaling the Data Feed
Socialite, the Open Source Status Feed Part 3: Scaling the Data Feed
 
Conceptos básicos. Seminario web 4: Indexación avanzada, índices de texto y g...
Conceptos básicos. Seminario web 4: Indexación avanzada, índices de texto y g...Conceptos básicos. Seminario web 4: Indexación avanzada, índices de texto y g...
Conceptos básicos. Seminario web 4: Indexación avanzada, índices de texto y g...
 

Andere mochten auch

Webinar: Schema Design and Performance Implications
Webinar: Schema Design and Performance ImplicationsWebinar: Schema Design and Performance Implications
Webinar: Schema Design and Performance ImplicationsMongoDB
 
Mongo at Sailthru (MongoNYC 2011)
Mongo at Sailthru (MongoNYC 2011)Mongo at Sailthru (MongoNYC 2011)
Mongo at Sailthru (MongoNYC 2011)ibwhite
 
Indexing with MongoDB
Indexing with MongoDBIndexing with MongoDB
Indexing with MongoDBMongoDB
 
OTA Platform with MongoDB
OTA Platform with MongoDBOTA Platform with MongoDB
OTA Platform with MongoDBHadi Ariawan
 
MongoDB for Time Series Data
MongoDB for Time Series DataMongoDB for Time Series Data
MongoDB for Time Series DataMongoDB
 
Back to Basics Webinar 1: Introduction to NoSQL
Back to Basics Webinar 1: Introduction to NoSQLBack to Basics Webinar 1: Introduction to NoSQL
Back to Basics Webinar 1: Introduction to NoSQLMongoDB
 
MongoDB Analytics: Learn Aggregation by Example - Exploratory Analytics and V...
MongoDB Analytics: Learn Aggregation by Example - Exploratory Analytics and V...MongoDB Analytics: Learn Aggregation by Example - Exploratory Analytics and V...
MongoDB Analytics: Learn Aggregation by Example - Exploratory Analytics and V...MongoDB
 
Webinar: 10-Step Guide to Creating a Single View of your Business
Webinar: 10-Step Guide to Creating a Single View of your BusinessWebinar: 10-Step Guide to Creating a Single View of your Business
Webinar: 10-Step Guide to Creating a Single View of your BusinessMongoDB
 
Leveraging MongoDB as a Data Store for Security Data
Leveraging MongoDB as a Data Store for Security DataLeveraging MongoDB as a Data Store for Security Data
Leveraging MongoDB as a Data Store for Security DataMongoDB
 
Breaking the oracle tie
Breaking the oracle tieBreaking the oracle tie
Breaking the oracle tieagiamas
 
Advanced Document Modeling Techniques from a High-Scale Commerce Platform
Advanced Document Modeling Techniques from a High-Scale Commerce PlatformAdvanced Document Modeling Techniques from a High-Scale Commerce Platform
Advanced Document Modeling Techniques from a High-Scale Commerce PlatformMongoDB
 
Webinaire 1 de la série Retour aux fondamentaux : Introduction à NoSQL
Webinaire 1 de la série Retour aux fondamentaux : Introduction à NoSQLWebinaire 1 de la série Retour aux fondamentaux : Introduction à NoSQL
Webinaire 1 de la série Retour aux fondamentaux : Introduction à NoSQLMongoDB
 
Indexing and Query Optimizer (Aaron Staple)
Indexing and Query Optimizer (Aaron Staple)Indexing and Query Optimizer (Aaron Staple)
Indexing and Query Optimizer (Aaron Staple)MongoSF
 
Schema Design
Schema DesignSchema Design
Schema DesignMongoDB
 
Production deployment
Production deploymentProduction deployment
Production deploymentMongoDB
 
Webinar: Schema Patterns and Your Storage Engine
Webinar: Schema Patterns and Your Storage EngineWebinar: Schema Patterns and Your Storage Engine
Webinar: Schema Patterns and Your Storage EngineMongoDB
 
An Introduction to MongoDB Compass
An Introduction to MongoDB CompassAn Introduction to MongoDB Compass
An Introduction to MongoDB CompassMongoDB
 
MongoDB Schema Design (Event: An Evening with MongoDB Houston 3/11/15)
MongoDB Schema Design (Event: An Evening with MongoDB Houston 3/11/15)MongoDB Schema Design (Event: An Evening with MongoDB Houston 3/11/15)
MongoDB Schema Design (Event: An Evening with MongoDB Houston 3/11/15)MongoDB
 
Strengths and Weaknesses of MongoDB
Strengths and Weaknesses of MongoDBStrengths and Weaknesses of MongoDB
Strengths and Weaknesses of MongoDBlehresman
 
MongoDB at Mailbox
MongoDB at MailboxMongoDB at Mailbox
MongoDB at MailboxMongoDB
 

Andere mochten auch (20)

Webinar: Schema Design and Performance Implications
Webinar: Schema Design and Performance ImplicationsWebinar: Schema Design and Performance Implications
Webinar: Schema Design and Performance Implications
 
Mongo at Sailthru (MongoNYC 2011)
Mongo at Sailthru (MongoNYC 2011)Mongo at Sailthru (MongoNYC 2011)
Mongo at Sailthru (MongoNYC 2011)
 
Indexing with MongoDB
Indexing with MongoDBIndexing with MongoDB
Indexing with MongoDB
 
OTA Platform with MongoDB
OTA Platform with MongoDBOTA Platform with MongoDB
OTA Platform with MongoDB
 
MongoDB for Time Series Data
MongoDB for Time Series DataMongoDB for Time Series Data
MongoDB for Time Series Data
 
Back to Basics Webinar 1: Introduction to NoSQL
Back to Basics Webinar 1: Introduction to NoSQLBack to Basics Webinar 1: Introduction to NoSQL
Back to Basics Webinar 1: Introduction to NoSQL
 
MongoDB Analytics: Learn Aggregation by Example - Exploratory Analytics and V...
MongoDB Analytics: Learn Aggregation by Example - Exploratory Analytics and V...MongoDB Analytics: Learn Aggregation by Example - Exploratory Analytics and V...
MongoDB Analytics: Learn Aggregation by Example - Exploratory Analytics and V...
 
Webinar: 10-Step Guide to Creating a Single View of your Business
Webinar: 10-Step Guide to Creating a Single View of your BusinessWebinar: 10-Step Guide to Creating a Single View of your Business
Webinar: 10-Step Guide to Creating a Single View of your Business
 
Leveraging MongoDB as a Data Store for Security Data
Leveraging MongoDB as a Data Store for Security DataLeveraging MongoDB as a Data Store for Security Data
Leveraging MongoDB as a Data Store for Security Data
 
Breaking the oracle tie
Breaking the oracle tieBreaking the oracle tie
Breaking the oracle tie
 
Advanced Document Modeling Techniques from a High-Scale Commerce Platform
Advanced Document Modeling Techniques from a High-Scale Commerce PlatformAdvanced Document Modeling Techniques from a High-Scale Commerce Platform
Advanced Document Modeling Techniques from a High-Scale Commerce Platform
 
Webinaire 1 de la série Retour aux fondamentaux : Introduction à NoSQL
Webinaire 1 de la série Retour aux fondamentaux : Introduction à NoSQLWebinaire 1 de la série Retour aux fondamentaux : Introduction à NoSQL
Webinaire 1 de la série Retour aux fondamentaux : Introduction à NoSQL
 
Indexing and Query Optimizer (Aaron Staple)
Indexing and Query Optimizer (Aaron Staple)Indexing and Query Optimizer (Aaron Staple)
Indexing and Query Optimizer (Aaron Staple)
 
Schema Design
Schema DesignSchema Design
Schema Design
 
Production deployment
Production deploymentProduction deployment
Production deployment
 
Webinar: Schema Patterns and Your Storage Engine
Webinar: Schema Patterns and Your Storage EngineWebinar: Schema Patterns and Your Storage Engine
Webinar: Schema Patterns and Your Storage Engine
 
An Introduction to MongoDB Compass
An Introduction to MongoDB CompassAn Introduction to MongoDB Compass
An Introduction to MongoDB Compass
 
MongoDB Schema Design (Event: An Evening with MongoDB Houston 3/11/15)
MongoDB Schema Design (Event: An Evening with MongoDB Houston 3/11/15)MongoDB Schema Design (Event: An Evening with MongoDB Houston 3/11/15)
MongoDB Schema Design (Event: An Evening with MongoDB Houston 3/11/15)
 
Strengths and Weaknesses of MongoDB
Strengths and Weaknesses of MongoDBStrengths and Weaknesses of MongoDB
Strengths and Weaknesses of MongoDB
 
MongoDB at Mailbox
MongoDB at MailboxMongoDB at Mailbox
MongoDB at Mailbox
 

Ähnlich wie Webinar: Schema Design

Schema Design
Schema DesignSchema Design
Schema DesignMongoDB
 
Schema design
Schema designSchema design
Schema designMongoDB
 
Schema Design
Schema DesignSchema Design
Schema DesignMongoDB
 
Jumpstart: Schema Design
Jumpstart: Schema DesignJumpstart: Schema Design
Jumpstart: Schema DesignMongoDB
 
Schema design mongo_boston
Schema design mongo_bostonSchema design mongo_boston
Schema design mongo_bostonMongoDB
 
Schema Design
Schema DesignSchema Design
Schema DesignMongoDB
 
Schema Design
Schema DesignSchema Design
Schema DesignMongoDB
 
Schema & Design
Schema & DesignSchema & Design
Schema & DesignMongoDB
 
Schema design
Schema designSchema design
Schema designchristkv
 
Schema Design
Schema DesignSchema Design
Schema DesignMongoDB
 
Schema Design
Schema DesignSchema Design
Schema DesignMongoDB
 
Schema Design
Schema DesignSchema Design
Schema DesignMongoDB
 
Webinar: Schema Design
Webinar: Schema DesignWebinar: Schema Design
Webinar: Schema DesignMongoDB
 
MongoDB San Francisco 2013: Schema design presented by Jason Zucchetto, Consu...
MongoDB San Francisco 2013: Schema design presented by Jason Zucchetto, Consu...MongoDB San Francisco 2013: Schema design presented by Jason Zucchetto, Consu...
MongoDB San Francisco 2013: Schema design presented by Jason Zucchetto, Consu...MongoDB
 
Webinar: General Technical Overview of MongoDB for Dev Teams
Webinar: General Technical Overview of MongoDB for Dev TeamsWebinar: General Technical Overview of MongoDB for Dev Teams
Webinar: General Technical Overview of MongoDB for Dev TeamsMongoDB
 
Schema Design
Schema DesignSchema Design
Schema DesignMongoDB
 
Modeling JSON data for NoSQL document databases
Modeling JSON data for NoSQL document databasesModeling JSON data for NoSQL document databases
Modeling JSON data for NoSQL document databasesRyan CrawCour
 
Schema Design
Schema Design Schema Design
Schema Design MongoDB
 
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
 

Ähnlich wie Webinar: Schema Design (20)

Schema Design
Schema DesignSchema Design
Schema Design
 
Schema design
Schema designSchema design
Schema design
 
Schema Design
Schema DesignSchema Design
Schema Design
 
Jumpstart: Schema Design
Jumpstart: Schema DesignJumpstart: Schema Design
Jumpstart: Schema Design
 
Schema design mongo_boston
Schema design mongo_bostonSchema design mongo_boston
Schema design mongo_boston
 
Schema Design
Schema DesignSchema Design
Schema Design
 
Schema Design
Schema DesignSchema Design
Schema Design
 
Schema & Design
Schema & DesignSchema & Design
Schema & Design
 
Schema design
Schema designSchema design
Schema design
 
Schema Design
Schema DesignSchema Design
Schema Design
 
Schema Design
Schema DesignSchema Design
Schema Design
 
Schema Design
Schema DesignSchema Design
Schema Design
 
Webinar: Schema Design
Webinar: Schema DesignWebinar: Schema Design
Webinar: Schema Design
 
MongoDB San Francisco 2013: Schema design presented by Jason Zucchetto, Consu...
MongoDB San Francisco 2013: Schema design presented by Jason Zucchetto, Consu...MongoDB San Francisco 2013: Schema design presented by Jason Zucchetto, Consu...
MongoDB San Francisco 2013: Schema design presented by Jason Zucchetto, Consu...
 
Webinar: General Technical Overview of MongoDB for Dev Teams
Webinar: General Technical Overview of MongoDB for Dev TeamsWebinar: General Technical Overview of MongoDB for Dev Teams
Webinar: General Technical Overview of MongoDB for Dev Teams
 
Schema Design
Schema DesignSchema Design
Schema Design
 
Modeling JSON data for NoSQL document databases
Modeling JSON data for NoSQL document databasesModeling JSON data for NoSQL document databases
Modeling JSON data for NoSQL document databases
 
Schema Design
Schema Design Schema Design
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
 

Mehr von MongoDB

MongoDB SoCal 2020: Migrate Anything* to MongoDB Atlas
MongoDB SoCal 2020: Migrate Anything* to MongoDB AtlasMongoDB SoCal 2020: Migrate Anything* to MongoDB Atlas
MongoDB SoCal 2020: Migrate Anything* to MongoDB AtlasMongoDB
 
MongoDB SoCal 2020: Go on a Data Safari with MongoDB Charts!
MongoDB SoCal 2020: Go on a Data Safari with MongoDB Charts!MongoDB SoCal 2020: Go on a Data Safari with MongoDB Charts!
MongoDB SoCal 2020: Go on a Data Safari with MongoDB Charts!MongoDB
 
MongoDB SoCal 2020: Using MongoDB Services in Kubernetes: Any Platform, Devel...
MongoDB SoCal 2020: Using MongoDB Services in Kubernetes: Any Platform, Devel...MongoDB SoCal 2020: Using MongoDB Services in Kubernetes: Any Platform, Devel...
MongoDB SoCal 2020: Using MongoDB Services in Kubernetes: Any Platform, Devel...MongoDB
 
MongoDB SoCal 2020: A Complete Methodology of Data Modeling for MongoDB
MongoDB SoCal 2020: A Complete Methodology of Data Modeling for MongoDBMongoDB SoCal 2020: A Complete Methodology of Data Modeling for MongoDB
MongoDB SoCal 2020: A Complete Methodology of Data Modeling for MongoDBMongoDB
 
MongoDB SoCal 2020: From Pharmacist to Analyst: Leveraging MongoDB for Real-T...
MongoDB SoCal 2020: From Pharmacist to Analyst: Leveraging MongoDB for Real-T...MongoDB SoCal 2020: From Pharmacist to Analyst: Leveraging MongoDB for Real-T...
MongoDB SoCal 2020: From Pharmacist to Analyst: Leveraging MongoDB for Real-T...MongoDB
 
MongoDB SoCal 2020: Best Practices for Working with IoT and Time-series Data
MongoDB SoCal 2020: Best Practices for Working with IoT and Time-series DataMongoDB SoCal 2020: Best Practices for Working with IoT and Time-series Data
MongoDB SoCal 2020: Best Practices for Working with IoT and Time-series DataMongoDB
 
MongoDB SoCal 2020: MongoDB Atlas Jump Start
 MongoDB SoCal 2020: MongoDB Atlas Jump Start MongoDB SoCal 2020: MongoDB Atlas Jump Start
MongoDB SoCal 2020: MongoDB Atlas Jump StartMongoDB
 
MongoDB .local San Francisco 2020: Powering the new age data demands [Infosys]
MongoDB .local San Francisco 2020: Powering the new age data demands [Infosys]MongoDB .local San Francisco 2020: Powering the new age data demands [Infosys]
MongoDB .local San Francisco 2020: Powering the new age data demands [Infosys]MongoDB
 
MongoDB .local San Francisco 2020: Using Client Side Encryption in MongoDB 4.2
MongoDB .local San Francisco 2020: Using Client Side Encryption in MongoDB 4.2MongoDB .local San Francisco 2020: Using Client Side Encryption in MongoDB 4.2
MongoDB .local San Francisco 2020: Using Client Side Encryption in MongoDB 4.2MongoDB
 
MongoDB .local San Francisco 2020: Using MongoDB Services in Kubernetes: any ...
MongoDB .local San Francisco 2020: Using MongoDB Services in Kubernetes: any ...MongoDB .local San Francisco 2020: Using MongoDB Services in Kubernetes: any ...
MongoDB .local San Francisco 2020: Using MongoDB Services in Kubernetes: any ...MongoDB
 
MongoDB .local San Francisco 2020: Go on a Data Safari with MongoDB Charts!
MongoDB .local San Francisco 2020: Go on a Data Safari with MongoDB Charts!MongoDB .local San Francisco 2020: Go on a Data Safari with MongoDB Charts!
MongoDB .local San Francisco 2020: Go on a Data Safari with MongoDB Charts!MongoDB
 
MongoDB .local San Francisco 2020: From SQL to NoSQL -- Changing Your Mindset
MongoDB .local San Francisco 2020: From SQL to NoSQL -- Changing Your MindsetMongoDB .local San Francisco 2020: From SQL to NoSQL -- Changing Your Mindset
MongoDB .local San Francisco 2020: From SQL to NoSQL -- Changing Your MindsetMongoDB
 
MongoDB .local San Francisco 2020: MongoDB Atlas Jumpstart
MongoDB .local San Francisco 2020: MongoDB Atlas JumpstartMongoDB .local San Francisco 2020: MongoDB Atlas Jumpstart
MongoDB .local San Francisco 2020: MongoDB Atlas JumpstartMongoDB
 
MongoDB .local San Francisco 2020: Tips and Tricks++ for Querying and Indexin...
MongoDB .local San Francisco 2020: Tips and Tricks++ for Querying and Indexin...MongoDB .local San Francisco 2020: Tips and Tricks++ for Querying and Indexin...
MongoDB .local San Francisco 2020: Tips and Tricks++ for Querying and Indexin...MongoDB
 
MongoDB .local San Francisco 2020: Aggregation Pipeline Power++
MongoDB .local San Francisco 2020: Aggregation Pipeline Power++MongoDB .local San Francisco 2020: Aggregation Pipeline Power++
MongoDB .local San Francisco 2020: Aggregation Pipeline Power++MongoDB
 
MongoDB .local San Francisco 2020: A Complete Methodology of Data Modeling fo...
MongoDB .local San Francisco 2020: A Complete Methodology of Data Modeling fo...MongoDB .local San Francisco 2020: A Complete Methodology of Data Modeling fo...
MongoDB .local San Francisco 2020: A Complete Methodology of Data Modeling fo...MongoDB
 
MongoDB .local San Francisco 2020: MongoDB Atlas Data Lake Technical Deep Dive
MongoDB .local San Francisco 2020: MongoDB Atlas Data Lake Technical Deep DiveMongoDB .local San Francisco 2020: MongoDB Atlas Data Lake Technical Deep Dive
MongoDB .local San Francisco 2020: MongoDB Atlas Data Lake Technical Deep DiveMongoDB
 
MongoDB .local San Francisco 2020: Developing Alexa Skills with MongoDB & Golang
MongoDB .local San Francisco 2020: Developing Alexa Skills with MongoDB & GolangMongoDB .local San Francisco 2020: Developing Alexa Skills with MongoDB & Golang
MongoDB .local San Francisco 2020: Developing Alexa Skills with MongoDB & GolangMongoDB
 
MongoDB .local Paris 2020: Realm : l'ingrédient secret pour de meilleures app...
MongoDB .local Paris 2020: Realm : l'ingrédient secret pour de meilleures app...MongoDB .local Paris 2020: Realm : l'ingrédient secret pour de meilleures app...
MongoDB .local Paris 2020: Realm : l'ingrédient secret pour de meilleures app...MongoDB
 
MongoDB .local Paris 2020: Upply @MongoDB : Upply : Quand le Machine Learning...
MongoDB .local Paris 2020: Upply @MongoDB : Upply : Quand le Machine Learning...MongoDB .local Paris 2020: Upply @MongoDB : Upply : Quand le Machine Learning...
MongoDB .local Paris 2020: Upply @MongoDB : Upply : Quand le Machine Learning...MongoDB
 

Mehr von MongoDB (20)

MongoDB SoCal 2020: Migrate Anything* to MongoDB Atlas
MongoDB SoCal 2020: Migrate Anything* to MongoDB AtlasMongoDB SoCal 2020: Migrate Anything* to MongoDB Atlas
MongoDB SoCal 2020: Migrate Anything* to MongoDB Atlas
 
MongoDB SoCal 2020: Go on a Data Safari with MongoDB Charts!
MongoDB SoCal 2020: Go on a Data Safari with MongoDB Charts!MongoDB SoCal 2020: Go on a Data Safari with MongoDB Charts!
MongoDB SoCal 2020: Go on a Data Safari with MongoDB Charts!
 
MongoDB SoCal 2020: Using MongoDB Services in Kubernetes: Any Platform, Devel...
MongoDB SoCal 2020: Using MongoDB Services in Kubernetes: Any Platform, Devel...MongoDB SoCal 2020: Using MongoDB Services in Kubernetes: Any Platform, Devel...
MongoDB SoCal 2020: Using MongoDB Services in Kubernetes: Any Platform, Devel...
 
MongoDB SoCal 2020: A Complete Methodology of Data Modeling for MongoDB
MongoDB SoCal 2020: A Complete Methodology of Data Modeling for MongoDBMongoDB SoCal 2020: A Complete Methodology of Data Modeling for MongoDB
MongoDB SoCal 2020: A Complete Methodology of Data Modeling for MongoDB
 
MongoDB SoCal 2020: From Pharmacist to Analyst: Leveraging MongoDB for Real-T...
MongoDB SoCal 2020: From Pharmacist to Analyst: Leveraging MongoDB for Real-T...MongoDB SoCal 2020: From Pharmacist to Analyst: Leveraging MongoDB for Real-T...
MongoDB SoCal 2020: From Pharmacist to Analyst: Leveraging MongoDB for Real-T...
 
MongoDB SoCal 2020: Best Practices for Working with IoT and Time-series Data
MongoDB SoCal 2020: Best Practices for Working with IoT and Time-series DataMongoDB SoCal 2020: Best Practices for Working with IoT and Time-series Data
MongoDB SoCal 2020: Best Practices for Working with IoT and Time-series Data
 
MongoDB SoCal 2020: MongoDB Atlas Jump Start
 MongoDB SoCal 2020: MongoDB Atlas Jump Start MongoDB SoCal 2020: MongoDB Atlas Jump Start
MongoDB SoCal 2020: MongoDB Atlas Jump Start
 
MongoDB .local San Francisco 2020: Powering the new age data demands [Infosys]
MongoDB .local San Francisco 2020: Powering the new age data demands [Infosys]MongoDB .local San Francisco 2020: Powering the new age data demands [Infosys]
MongoDB .local San Francisco 2020: Powering the new age data demands [Infosys]
 
MongoDB .local San Francisco 2020: Using Client Side Encryption in MongoDB 4.2
MongoDB .local San Francisco 2020: Using Client Side Encryption in MongoDB 4.2MongoDB .local San Francisco 2020: Using Client Side Encryption in MongoDB 4.2
MongoDB .local San Francisco 2020: Using Client Side Encryption in MongoDB 4.2
 
MongoDB .local San Francisco 2020: Using MongoDB Services in Kubernetes: any ...
MongoDB .local San Francisco 2020: Using MongoDB Services in Kubernetes: any ...MongoDB .local San Francisco 2020: Using MongoDB Services in Kubernetes: any ...
MongoDB .local San Francisco 2020: Using MongoDB Services in Kubernetes: any ...
 
MongoDB .local San Francisco 2020: Go on a Data Safari with MongoDB Charts!
MongoDB .local San Francisco 2020: Go on a Data Safari with MongoDB Charts!MongoDB .local San Francisco 2020: Go on a Data Safari with MongoDB Charts!
MongoDB .local San Francisco 2020: Go on a Data Safari with MongoDB Charts!
 
MongoDB .local San Francisco 2020: From SQL to NoSQL -- Changing Your Mindset
MongoDB .local San Francisco 2020: From SQL to NoSQL -- Changing Your MindsetMongoDB .local San Francisco 2020: From SQL to NoSQL -- Changing Your Mindset
MongoDB .local San Francisco 2020: From SQL to NoSQL -- Changing Your Mindset
 
MongoDB .local San Francisco 2020: MongoDB Atlas Jumpstart
MongoDB .local San Francisco 2020: MongoDB Atlas JumpstartMongoDB .local San Francisco 2020: MongoDB Atlas Jumpstart
MongoDB .local San Francisco 2020: MongoDB Atlas Jumpstart
 
MongoDB .local San Francisco 2020: Tips and Tricks++ for Querying and Indexin...
MongoDB .local San Francisco 2020: Tips and Tricks++ for Querying and Indexin...MongoDB .local San Francisco 2020: Tips and Tricks++ for Querying and Indexin...
MongoDB .local San Francisco 2020: Tips and Tricks++ for Querying and Indexin...
 
MongoDB .local San Francisco 2020: Aggregation Pipeline Power++
MongoDB .local San Francisco 2020: Aggregation Pipeline Power++MongoDB .local San Francisco 2020: Aggregation Pipeline Power++
MongoDB .local San Francisco 2020: Aggregation Pipeline Power++
 
MongoDB .local San Francisco 2020: A Complete Methodology of Data Modeling fo...
MongoDB .local San Francisco 2020: A Complete Methodology of Data Modeling fo...MongoDB .local San Francisco 2020: A Complete Methodology of Data Modeling fo...
MongoDB .local San Francisco 2020: A Complete Methodology of Data Modeling fo...
 
MongoDB .local San Francisco 2020: MongoDB Atlas Data Lake Technical Deep Dive
MongoDB .local San Francisco 2020: MongoDB Atlas Data Lake Technical Deep DiveMongoDB .local San Francisco 2020: MongoDB Atlas Data Lake Technical Deep Dive
MongoDB .local San Francisco 2020: MongoDB Atlas Data Lake Technical Deep Dive
 
MongoDB .local San Francisco 2020: Developing Alexa Skills with MongoDB & Golang
MongoDB .local San Francisco 2020: Developing Alexa Skills with MongoDB & GolangMongoDB .local San Francisco 2020: Developing Alexa Skills with MongoDB & Golang
MongoDB .local San Francisco 2020: Developing Alexa Skills with MongoDB & Golang
 
MongoDB .local Paris 2020: Realm : l'ingrédient secret pour de meilleures app...
MongoDB .local Paris 2020: Realm : l'ingrédient secret pour de meilleures app...MongoDB .local Paris 2020: Realm : l'ingrédient secret pour de meilleures app...
MongoDB .local Paris 2020: Realm : l'ingrédient secret pour de meilleures app...
 
MongoDB .local Paris 2020: Upply @MongoDB : Upply : Quand le Machine Learning...
MongoDB .local Paris 2020: Upply @MongoDB : Upply : Quand le Machine Learning...MongoDB .local Paris 2020: Upply @MongoDB : Upply : Quand le Machine Learning...
MongoDB .local Paris 2020: Upply @MongoDB : Upply : Quand le Machine Learning...
 

Kürzlich hochgeladen

A Framework for Development in the AI Age
A Framework for Development in the AI AgeA Framework for Development in the AI Age
A Framework for Development in the AI AgeCprime
 
Potential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsPotential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsRavi Sanghani
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsNathaniel Shimoni
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.Curtis Poe
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsPixlogix Infotech
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxLoriGlavin3
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024Lonnie McRorey
 
Data governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationData governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationKnoldus Inc.
 
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Alkin Tezuysal
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
Generative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfGenerative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfIngrid Airi González
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxLoriGlavin3
 
Testing tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesTesting tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesKari Kakkonen
 
Sample pptx for embedding into website for demo
Sample pptx for embedding into website for demoSample pptx for embedding into website for demo
Sample pptx for embedding into website for demoHarshalMandlekar2
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfLoriGlavin3
 
Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Hiroshi SHIBATA
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
Manual 508 Accessibility Compliance Audit
Manual 508 Accessibility Compliance AuditManual 508 Accessibility Compliance Audit
Manual 508 Accessibility Compliance AuditSkynet Technologies
 
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesHow to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesThousandEyes
 
2024 April Patch Tuesday
2024 April Patch Tuesday2024 April Patch Tuesday
2024 April Patch TuesdayIvanti
 

Kürzlich hochgeladen (20)

A Framework for Development in the AI Age
A Framework for Development in the AI AgeA Framework for Development in the AI Age
A Framework for Development in the AI Age
 
Potential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsPotential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and Insights
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directions
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and Cons
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
 
Data governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationData governance with Unity Catalog Presentation
Data governance with Unity Catalog Presentation
 
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
Generative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfGenerative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdf
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptx
 
Testing tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesTesting tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examples
 
Sample pptx for embedding into website for demo
Sample pptx for embedding into website for demoSample pptx for embedding into website for demo
Sample pptx for embedding into website for demo
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdf
 
Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
Manual 508 Accessibility Compliance Audit
Manual 508 Accessibility Compliance AuditManual 508 Accessibility Compliance Audit
Manual 508 Accessibility Compliance Audit
 
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesHow to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
 
2024 April Patch Tuesday
2024 April Patch Tuesday2024 April Patch Tuesday
2024 April Patch Tuesday
 

Webinar: Schema Design

  • 1. Schema Design Buzz Moschetti Enterprise Architect, MongoDB buzz.moschetti@mongodb.com @buzzmoschetti
  • 2. 2 Before We Begin • This webinar is being recorded • Use The Chat Window for • Technical assistance • Q&A • MongoDB Team will answer questions • Common questions will be reviewed at the end of the webinar
  • 3. Theme #1: Great Schema Design involves much more than the database • Easily understood structures • Harmonized with software • Acknowledging legacy issues
  • 4. Theme #2: Today’s solutions need to accommodate tomorrow’s needs • End of “Requirements Complete” • Ability to economically scale • Shorter solutions lifecycles
  • 6. RDBMS MongoDB Database Database Table Collection Index Index Row Document Join Embedding & Linking Terminology
  • 7. { _id: “123”, title: "MongoDB: The Definitive Guide", authors: [ { _id: "kchodorow", name: "Kristina Chodorow“ }, { _id: "mdirold", name: “Mike Dirolf“ } ], published_date: ISODate("2010-09-24"), pages: 216, language: "English", thumbnail: BinData(0,"AREhMQ=="), publisher: { name: "O’Reilly Media", founded: 1980, locations: ["CA”, ”NY” ] } } What is a Document?
  • 8. // Java: maps DBObject query = new BasicDBObject(”publisher.founded”, 1980)); Map m = collection.findOne(query); Date pubDate = (Date)m.get(”published_date”); // java.util.Date // Javascript: objects m = collection.findOne({”publisher.founded” : 1980}); pubDate = m.published_date; // ISODate year = pubDate.getUTCFullYear(); # Python: dictionaries m = coll.find_one({”publisher.founded” : 1980 }); pubDate = m[”pubDate”].year # datetime.datetime Documents Map to Language Constructs
  • 9. 9 Traditional Schema Design • Static, Uniform Scalar Data • Rectangles • Low-level, physical representation
  • 10. 10 Document Schema Design • Flexible, Rich Shapes • Objects • Higher-level, business representation
  • 12. 12 Library Management Application • Patrons/Users • Books • Authors • Publishers
  • 13. 13 Question: What is a Patron’s Address?
  • 14. A Patron and their Address > patron = db.patrons.find({ _id : “joe” }) { _id: "joe“, name: "Joe Bookreader”, favoriteGenres: [ ”mystery”, ”programming” ] } > address = db.addresses.find({ _id : “joe” }) { _id: "joe“, street: "123 Fake St.", city: "Faketon", state: "MA", zip: 12345 }
  • 15. A Patron and their Address > patron = db.patrons.find({ _id : “joe” }) { _id: "joe", name: "Joe Bookreader", favoriteGenres: [ ”mystery”, ”programming” ] address: { street: "123 Fake St. ", city: "Faketon", state: "MA", zip: 12345 } }
  • 16. Projection: Return only what you need > patron = db.patrons.find({ _id : “joe” }, {“_id”: 0, ”address”:1}) { address: { street: "123 Fake St. ", city: "Faketon", state: "MA", zip: 12345 } } > patron = db.patrons.find({ _id : “joe” }, {“_id”: 0, “name”:1, ”address.state”:1}) { name: "Joe Bookreader", address: { state: "MA” } }
  • 17. 17 One-to-One Relationships • “Belongs to” relationships are often embedded • Holistic representation of entities with their embedded attributes and relationships. • Great read performance Most important: • Keeps simple things simple • Frees up time to tackle harder schema design issues
  • 18. 18 Question: What are a Patron’s Addresses?
  • 19. A Patron and their Addresses > patron = db.patrons.find({ _id : “bob” }) { _id: “bob", name: “Bob Knowitall", addresses: [ {street: "1 Vernon St.", city: "Newton", …}, {street: "52 Main St.", city: "Boston", …} ] }
  • 20. A Patron and their Addresses > patron = db.patrons.find({ _id : “bob” }) { _id: “bob", name: “Bob Knowitall", addresses: [ {street: "1 Vernon St.", city: "Newton", …}, {street: "52 Main St.", city: "Boston", …} ] } > patron = db.patrons.find({ _id : “joe” }) { _id: "joe", name: "Joe Bookreader", address: { street: "123 Fake St. ", city: "Faketon", …} }
  • 21. 21 Migration Options • Migrate all documents when the schema changes. • Migrate On-Demand – As we pull up a patron’s document, we make the change. – Any patrons that never come into the library never get updated. • Leave it alone – The code layer knows about both address and addresses
  • 22. 22 The Utility of Substructure Map d = collection.find(new BasicDBObject(”_id”,”Bob”)); Map addr = (Map) d.get(”address”); If(addr == null) { List<Map> addrl = (List) d.get(”addresses”); addr = addrl.get(0); } doSomethingWithOneAddress(addr); /** If later we add “region” to the address substructure, none of the queries have to change! Another value will appear in the Map (or not -- and that can be interrogated) and be processed. **/
  • 23. 23 Question: Who is the publisher of this book?
  • 24. 24 Book • MongoDB: The Definitive Guide, • By Kristina Chodorow and Mike Dirolf • Published: 9/24/2010 • Pages: 216 • Language: English • Publisher: O’Reilly Media, CA
  • 25. Book with embedded Publisher > book = db.books.find({ _id : “123” }) { _id: “123”, title: "MongoDB: The Definitive Guide", authors: [ "Kristina Chodorow", "Mike Dirolf" ], published_date: ISODate("2010-09-24"), pages: 216, language: "English", publisher: { name: "O’Reilly Media", founded: 1980, locations: ["CA”, ”NY” ] } }
  • 26. Don’t Forget the Substructure! > book = db.books.find({ _id : “123” }) { _id: “123”, title: "MongoDB: The Definitive Guide", authors: [ { first: "Kristina”, last: “Chodorow” }, { first: ”Mike”, last: “Dirolf” } ], published_date: ISODate("2010-09-24"), pages: 216, language: "English", publisher: { name: "O’Reilly Media", founded: 1980, locations: ["CA”, ”NY” ] } }
  • 27. 27 Book with embedded Publisher • Optimized for read performance of Books • We accept data duplication • An index on “publisher.name” provides: – Efficient lookup of all books for given publisher name – Efficient way to find all publisher names (distinct)
  • 28. Publishers as a Separate Entity > publishers = db.publishers.find() { _id: “oreilly”, name: "O’Reilly Media", founded: 1980, locations: ["CA”, ”NY” ] } { _id: “penguin”, name: “Penguin”, founded: 1983, locations: [ ”IL” ] }
  • 29. Book with Linked Publisher > book = db.books.find({ _id: “123” }) { _id: “123”, publisher_id: “oreilly”, title: "MongoDB: The Definitive Guide", … } > db.publishers.find({ _id : book.publisher_id }) { _id: “oreilly”, name: "O’Reilly Media", founded: 1980, locations: ["CA”, ”NY” ] }
  • 30. Books with Linked Publisher db.books.find({ criteria } ).forEach(function(r) { m[r.publisher.name] = 1; // Capture publisher ID }); uniqueIDs = Object.keys(m); cursor = db.publishers.find({"_id": {"$in": uniqueIDs } });
  • 31. 31 Question: What are all the books a publisher has published?
  • 32. Publisher with linked Books > publisher = db.publishers.find({ _id : “oreilly” }) { _id: “oreilly”, name: "O’Reilly Media", founded: 1980, locations: [ "CA“, ”NY” ], books: [“123”, “456”, “789”, “10112”, …] } > books = db.books.find({ _id: { $in : publisher.books } })
  • 33. 33 Question: Who are the authors of a given book?
  • 34. Books with linked Authors > book = db.books.find({ _id : “123” }) { _id: “123”, title: "MongoDB: The Definitive Guide", … authors: [ { _id: “X12”, first: "Kristina”, last: “Chodorow” }, { _id: “Y45”, first: ”Mike”, last: “Dirolf” } ], } > a2 = book.authors.map(function(r) { return r._id; }); > authors = db.authors.find({ _id : { $in : a2}}) {_id:”X12”,name:{first:"Kristina”,last:”Chodorow”},hometown: … } {_id:“Y45”,name:{first:”Mike”,last:”Dirolf”}, hometown: … }
  • 35. 35 Question: What are all the books an author has written?
  • 36. > authors = db.authors.find({ _id : “X12” }) { _id: ”X12", name: { first: "Kristina”, last: “Chodorow” } , hometown: "Cincinnati", books: [ {id: “123”, title : "MongoDB: The Definitive Guide“ } ] } > book = db.books.find({ _id : “123” }) { _id: “123”, title: "MongoDB: The Definitive Guide", … authors: [ { _id: “X12”, first: "Kristina”, last: “Chodorow” }, { _id: “Y45”, first: ”Mike”, last: “Dirolf” } ], } Double Link Books and Authors
  • 37. > book = db.books.find({ _id : “123” }) { authors: [ { _id: “X12”, first: "Kristina”, last: “Chodorow” }, { _id: “Y45”, first: ”Mike”, last: “Dirolf” } ], } > db.books.ensureIndex({“authors._id”: 1}); > db.books.find({ “authors._id” : “X12” }).explain(); { "cursor" : "BtreeCursor authors.id_1", … "millis" : 0, } …or Use Indexes
  • 38. 38 Embedding vs. Linking • Embedding – Terrific for read performance • Webapp “front pages” and pre-aggregated material • Complex structures – Inserts might be slower than linking – Data integrity needs to be managed • Linking – Flexible – Data integrity is built-in – Work is done during reads • But not necessarily more work than RDBMS
  • 39. 39 Question: What are the personalized attributes for each author?
  • 40. > db.authors.find() { _id: ”X12", name: { first: "Kristina”, last: “Chodorow” }, personalData: { favoritePets: [ “bird”, “dog” ], awards: [ {name: “Hugo”, when: 1983}, {name: “SSFX”, when: 1992} ] } } { _id: ”Y45", name: { first: ”Mike”, last: “Dirolf” } , personalData: { dob: ISODate(“1970-04-05”) } } Assign Dynamic Structure to a Known Name
  • 41. > db.events.find() { type: ”click", ts: ISODate(“2015-03-03T12:34:56.789Z”, data: { x: 123, y: 625, adId: “AE23A” } } { type: ”click", ts: ISODate(“2015-03-03T12:35:01.003Z”, data: { x: 456, y: 611, adId: “FA213” } } { type: ”view", ts: ISODate(“2015-03-03T12:35:04.102Z”, data: { scn: 2, reset: false, … } } { type: ”click", ts: ISODate(“2015-03-03T12:35:05.312Z”, data: { x: 23, y: 32, adId: “BB512” } } { type: ”close", ts: ISODate(“2015-03-03T12:35:08.774Z”, data: { snc: 2, … } } { type: ”click", ts: ISODate(“2015-03-03T12:35:10.114Z”, data: { x: 881, y: 913, adId: “F430” } } Polymorphism: Worth an Extra Slide
  • 42. 42 Question: What are all the books about databases?
  • 43. Categories as an Array > book = db.books.find({ _id : “123” }) { _id: “123”, title: "MongoDB: The Definitive Guide", categories: [“MongoDB”, “Databases”, “Programming”] } > db.books.find({ categories: “Databases” })
  • 44. Categories as a Path > book = db.books.find({ _id : “123” }) { _id: “123”, title: "MongoDB: The Definitive Guide", category: “Programming/Databases/MongoDB” } > db.books.find({ category: ^Programming/Databases/* })
  • 45. 45 Summary • Schema design is different in MongoDB – But basic data design principles stay the same • Focus on how an application accesses/manipulates data • Seek out and capture belongs-to 1:1 relationships • Use substructure to better align to code objects • Be polymorphic! • Evolve the schema to meet requirements as they change

Hinweis der Redaktion

  1. HELLO! This is Buzz Moschetti at MongoDB, and welcome to today’s webinar entitled “Schema Design” If your travel plans today do not include exploring schema design with MongoDB then please exit the aircraft immediately and see an agent at the gate Otherwise – WELCOME ABOARD for about the next hour.
  2. Some quick logistics. In the last 5 to 10 mins today, we will answer the most common questions that have been submitted.
  3. There are three themes that are important to grasp when thinking about schema design in MongoDB and these will be reinforced throughout the presentation. First, great schema design…. I’ll repeat it: great… This is not new or something revolutionary to MongoDB. It is something we have been doing all along in the construction of solutions. Sometimes well, sometimes not. It’s just that the data structures and APIs used by MongoDB make it much easier to satisfy the first two bullet points. Particularly for an up-stack software engineer kind of person like myself, the ease and power of well-harmonizing your persistence with your code – java, javascript, perl, python – is a vital part of ensuring your overall information architecture is robust. And WRT legacy issues, we need to confess to ourselves that even after 40 years, RDBMS design, software integration, and day 2 change still have many hurdles like field overloading and flattening Boils down to success = “schema” + code
  4. Potentially very provocative. In the old days, we had long requirements cycles and one or both of the following things happened: Requirements changed midstream, invalidating a lot of schema design already performed especially for certain 1:1 entity relationships High quality problem: The solution was asked to scale well beyond the original goals Increasingly, it is no longer acceptable to have a 6 or 12 or 18 month requirements phase to build a system that lasts 10 years or more. You want to get the initial information architecture done in a couple of weeks, expand upon it incrementally, and build a system that doesn’t have to live 10 years to “justify its development time.”
  5. Because MongoDB is impedance matched to the software around it, you have a great deal of design flexibility and even innovation in the way you construct the overall solution. Certainly, there are best practices to guide you to a particular design choice, but in most cases, you still have the ability to change course without a complete rethinking of the solution.
  6. Let’s talk about some the terms. JOINS: RDBMS uses Join to stich together fundamentally simple things into larger, more complex data. MongoDB uses embedding of data within data and linking to produce the same result
  7. A document is not a PDF or a MS word artifact. A document a term for a rich shape. Structures of structures of lists of structures that ultimately at the leaves have familiar scalars like int, double, datetimes, and string. In this example we see also that we’re carrying a thumbnail photo in a binary byte array type; that’s natively supported as well. This is very different than the traditional row-column approach used in RDBMS. Another important difference is that In MongoDB, the data is the schema, and it is expected that the code layer above MongoDB is responsible for all validation of content, types, and shape. Truth is in most non-trivial systems, even with RDBMS and stored procs, etc. plenty of that validation and logic is being handled outside the database; the MongoDB paradigm is to put it all there. Now here is something very important: For the purposes of the webinar, we will be seeing this “to-string” representation of a document as it is emitted from the MongoDB CLI. This is easy to read and gets the structural design points across nicely. But make no mistake: you want most of your actual software interaction with MongoDB (and frankly any DB) to be via high fidelity types, not a big string with whitespaces and CR and quotes and whatnot.
  8. Drivers in each language represent documents in a language-native form most appropriate for that language. Java has maps, python has dictionaries. You deal with actual objects like Dates, not strings that must be constructed or parsed. Another important note: We’ll be using query functionality to kill 2 birds with one stone: To show the shape of the document To show just a bit of the MongoDB query language itself. Note that in MongoDB, documents go into collections in the same shape they come out so we won’t focus on insert. This is a very different design paradigm from RDBMS, where, for example, the read-side of an operation implemented as an 8 way join is very different than the set of insert statements (some of them in a loop) required for the write side.
  9. Let’s get back to schemas. … This is largely because the design goals and constraints of legacy RDBMS engines heavily influence the data being put into them. Overall, the platform is focused on the physical representation. For example, although most have been conflated, the legacy types of char, varchar, text, CLOB etc. to represent a string suggest a strong coupling to byte-wise storage concerns.
  10. Documents, on the other hand, are more about business entities. You’ll want to think of your data moving in and out as objects, even though the analogy is not – and should not – be 100% true because we’re only dealing with data here, not in memory state and certainly not methods and behaviors. No compile time binding either!
  11. So what better way to show this than diving right into a problem?
  12. Today we’ll explore data structures and schema for a library management application Good example because in general most of you have some familiarity with the entities involved and we can explore some 1:1, 1:n and other design options
  13. To make things a little more interesting, we’ll capture our emerging requirements in the form of questions the application needs to ask the database. This is useful because, again, it helps us keep our eye on the software layer above the database Imagine a patron walks up to the counter and presents his/her library card to check out some books. The first thing a librarian might want to do is confirm the patron’s address so as to have a place to send the library police when the book isn’t returned in a timely manner.
  14. This might be the very first cut at such a thing, with 2 collections, patrons and addresses. Both share a common key space on the _id unique ID field. To get name and address will require 2 queries. Very important: You notice here that a list of favorite genres has been set up. It is a LIST of strings. Not a semicolon or comma delimited string. Each element of that list is completely addressable, queryable, and updatable via dotpath notation. As is the entire list. And should we require it, it is indexable. But let’s not get too far ahead. Can we do better?
  15. I think we can: embed the address substructure into the patron document. Only 1 query is necessary. You notice here that we treated address like an Object. We did not “faltten” everything out into addr_street, addr_city, addr_state, etc. We’ll come back to that again in just a few slides and see the power it provides.
  16. A common concern that pops up at this point is that every query will act like “SELECT *” and drag back potentially a LOT of data. You can control that with projection as we see here. This operation is of course processed server side and is efficient. Note that we can both pick up an entire substructure as a unit OR JUST specific subfields using “dot notation”. Very powerful.
  17. Let’s summarize one-to-one relationships. Read performance is optimized because we only need a single query and a single disk/memory hit.. MongoDB is especially useful in dealing with 1:1 belongs-to relationships Not every non-scalar datum is going to force you to create a new table, a foreign key, and key management.
  18. Business Requirements Change! People may have more than one address. And: we acknowledge that the legacy practice of assuming some small number of instances and flattening out addresses into address1 and address2 is bound to bump up against a situation where someone has 3 addresses. We’ve seen where that leads traditional schema design. We don’t want to repeat it.
  19. Now, just model addresses as an array. That was easy. No need to create a new table, set up foreign keys, do key management, etc. We combine the power of arrays with substructures. At times it takes longer to describe the change than it does to implement it and have it available as part of the information architecture including querying and indexing.
  20. No suppose this didn’t happen on day 2 but instead after the beta of the system was released. What about the old documents that had address, not addresses? There are 2 aspects to this issue. The MongoDB paradigm is that the code layer just above the DB is responsible for managing these types of things. The same code that is responsible for the higher-level business validation and verification is also responsible for selectively using (both on a read and write basis) the address or addresses field. There are several migration strategies that one could employ in conjunction with functionality at the code layer.
  21. Migrate on release: If address exists, write into new array of size 1 of new fields addresses and remove address field.
  22. Before I mentioned we’d see more about the power of substructure. Substructure is the concept that allows your schema to well-harmonize with software. By being able to pull out the entire address structure – either as a single field or part of the larger array of addresses, you can pass it to a function that does something interesting with no matter what fields are or are not set. And what’s really great is that these substructures are generic Maps or dictionaries – NO COMPILE TIME dependencies!
  23. Moving on, let’s look at another relationship in our emerging information architecture: publisher and books.
  24. Shameless plug! Note that a book may have multiple authors….
  25. Here’s a first cut at the design. Here, the 1:! Belongs-to relationship between book and publisher is not nearly as strong as patron to address But for the moment, let’s choose to duplicate publisher in every book that the publisher has published. Data duplication is OK because the publisher is largely immutable.
  26. Here’s an even better one: making the author name more granular by making it a substructure with separate first and last name elements. In a slightly different problem space, like real estate, imagine if you have lots of names: buyername, sellername, lawyername, executorname, guarantorname.
  27. This design will permit very high speed display of relevant book information. And we can still quickly look up all books for a given publisher.
  28. Suppose publisher info is not so static. Maybe we want to take a more traditional route and separate publisher information out into it’s own collection. We need to assign _ids and we’ll use simplified examples here. Note that in MongoDB each document needs a unique _id but it’s not important for today’s talk to get into the advanced topic of _id construction If you don’t supply one, one will be created automatically. And here’s a teaser: _id does not have to be a string or number or scalar: it can be a multi-field substructure! Note that the belongs-to 1:1 relationship of locations carries over nicely without fuss.
  29. It now takes 2 queries to pull the information. Now this isn’t the end of the world. It’s effectively no more code work than a JOIN. Instead of decomposing a resultset or passing the result into an ORM, your code layer deals directly with the database.
  30. If we want to get more than one book, no problem. Get the books and as you’re processing the book data, capture the publisher ID. We store it in a map to remove duplicate IDs Then we turn around and do an efficient lookup by primary key into the publishers collection. This works well regardless of whether the list is 1 long or 10,000. This is effectively a JOIN. An interesting thing here is the network hit. For relatively low numbers of publishers WRT to books, coupled with a good amount of publisher information, the network hit will be LOWER with this logic rather than a traditional JOIN! This is because the JOINed publisher data is NOT repeated over and over again in the result set.
  31. We have already seen a way to do this : by performing a find() on the Books collection with a particular publisher name OR publisher ID. But is there another way?
  32. As much as arrays are very useful in MongoDB, beware of the temptation to treat them as “rows.” Arrays should be “slow-growing” and not without a reasonable bound. For example, you wouldn’t carry system of record customer transactions as a array inside the customer. You MIGHT, however, for the purposes of speed at scale, duplicate the last 3 transactions as an array in the customer record – but that array is not growing without bound. From an underlying technology basis, this is less of an issue now with the WiredTiger storage engine available in 3.0 but you should still be mindful of it.
  33. As our schema is evolving, we’re beginning to see that an increasing number of questions can be efficiently answered by existing set of entities and relationships. This holds for authors; recall we set up the substructure of first and last names. But suppose we want more detail on an author?
  34. Let’s go ahead and create the Authors collection and link to it with a Author ID. Yes, we are using some fancier code here to extract the author IDs but in the end, it is still only 2 queries. The authors documents contain all sorts of information about each author. We have left the first and last names in the books document for the purposes of speed But we could get rid of them if we wanted….
  35. With this next question, we’re starting to get into the world of tradeoffs for performance and speed.
  36. Here’s one way to do it: Acknowledging that most authors are not steven king or danielle steele and have something of upper bound on the books they’ve written, we can doubly link the books and authors collection. In general the data is static so referential integrity is not as much as an issue as performance. Again, we’ve kept title in the stucture within the books field for performance purposes (to keep it to a single query) when looking up basic info about an author. But if so desired, we could just have books be an array of book IDs and use a 2-query approach as we’ve seen in prior slides.
  37. Remember: all fields including those inside structures inside arrays are indexable.
  38. Suppose the library wants to add value by having book clubs enhance the authors information with bespoke information. There are at least 3 challenges here: 1. the book club is operating semi-independently from the main system designers Clearly, we don’t know early on what the book club is going to add Each author may have a different set of information, create by a different member of the book club.
  39. This is a very, very exciting part of MongoDB. No need to come up with userDefined column 1, column 2, etc. We see here that Kristina and Mike have very different substructures inside the personalData field. We call this polymorphism: the variation of shape from document-to-document within the same collection. The library application logic only is looking for a field called “personalData”; actions will be taken dynamically based on the shape and types in the substructure! For example, It is a very straightforward exercise to recursively “walk” the structure and construct a panel in a GUI – especially if you are using AngularJS and the MEAN stack (MongoDB / Express / Angular / Node.js ) No need to use XML or blobs or serialized objects. It’s all native MongoDB -- and documents are represented in the form most easily natively manipulated by the language Every field is queryable and if so desired, indexable!
  40. Polymorphism is such an important topic it deserves another slide, even if it is independent of the library model. Here’s an events collection. We’ve taken out _id for some extra space. Type and ts and data are the well-known fields, and there is probably an index on type and ts. But the data field contents are specialized for each type. No need for complex tables or blobs or XML. And very easily extensible to new types we may need to add on day 2. This model extends to products, transactions, actors in a system. If you think about your data in terms of entities, you’ll discover that you probably only need a handful. That plus polymorphism within the entity gets you a long way. Because of this design approach, rarely will a MongoDB database have 100s of collections
  41. This is an example of faceted search or tagging in general.
  42. We can begin simply by implementing Categories as an array We probably will only have a few and they don’t change very often and have a natural upward bound. An index on categories will allow rapid retrieval. Again, a very appropriate use of belongs-to 1:1
  43. If we want a little more hierarchy, we can use regex operations. The category field is indexed as before, but now as a string Uses an index because of the anchored regular expression. There is a downside: when a category hierarchy gets changed, all documents will need to be re-categorized.
  44. On behalf of all of us at MongoDB , thank you for attending this webinar! I hope what you saw and heard today gave you some insight and clues into what you might face in your own schema design efforts. Remember you can always reach out to us at MongoDB for guidance. With that, code well and be well.