SlideShare a Scribd company logo
1 of 94
From Tables to Documents—
Changing Your Database Mindset
Lauren Schaefer, Developer Advocate, MongoDB
Parks and Recreation, Season 6, Episode 14 @Lauren_Schaefer #ndcoslo
@Lauren_Schaefer #ndcoslo
@Lauren_Schaefer #ndcoslo
@Lauren_Schaefer #ndcoslo
Parks and Recreation, Season 6, Episode 14 @Lauren_Schaefer #ndcoslo
@Lauren_Schaefer
Developer Advocate, MongoDB
@Lauren_Schaefer #ndcoslo
From Tables to
Documents
Changing Your Database Mindset
@Lauren_Schaefer #ndcoslo
Themental
journey from
tables to
documents
1. Map terms & concepts from tables to documents
2. Discover the 4 major advantages of documents
3. Change your mindset in 3 key ways
@Lauren_Schaefer #ndcoslo
Themental
journey from
tables to
documents
1. Map terms & concepts from tables to documents
2. Discover the 4 major advantages of documents
3. Change your mindset in 3 key ways
@Lauren_Schaefer #ndcoslo
Let’s talk
about
documents
@Lauren_Schaefer #ndcoslo
Let’s talk
about
documents
@Lauren_Schaefer #ndcoslo
Let’s talk
about
documents
{
}
@Lauren_Schaefer #ndcoslo
Let’s talk
about
documents
{
field: value,
field: value,
field: value
}
@Lauren_Schaefer #ndcoslo
@Lauren_Schaefer #ndcoslo
ID first_name last_name cell city
1 Leslie Yepp 8125552344 Pawnee
Users
@Lauren_Schaefer #ndcoslo
{
"_id": 1,
"first_name": "Leslie",
"last_name": "Yepp",
"cell": "8125552344",
"city": "Pawnee"
}
ID first_name last_name cell city
1 Leslie Yepp 8125552344 Pawnee
UsersUsers
@Lauren_Schaefer #ndcoslo
{
"_id": 1,
"first_name": "Leslie",
"last_name": "Yepp",
"cell": "8125552344",
"city": "Pawnee"
}
ID first_name last_name cell city latitude longitude
1 Leslie Yepp 8125552344 Pawnee 39.170344 -86.536632
UsersUsers
@Lauren_Schaefer #ndcoslo
{
"_id": 1,
"first_name": "Leslie",
"last_name": "Yepp",
"cell": "8125552344",
"city": "Pawnee",
"location": [ -86.536632, 39.170344 ]
}
ID first_name last_name cell city latitude longitude
1 Leslie Yepp 8125552344 Pawnee 39.170344 -86.536632
UsersUsers
@Lauren_Schaefer #ndcoslo
{
"_id": 1,
"first_name": "Leslie",
"last_name": "Yepp",
"cell": "8125552344",
"city": "Pawnee",
"location": [ -86.536632, 39.170344 ]
}
ID first_name last_name cell city latitude longitude
1 Leslie Yepp 8125552344 Pawnee 39.170344 -86.536632
UsersUsers
@Lauren_Schaefer #ndcoslo
{
"_id": 1,
"first_name": "Leslie",
"last_name": "Yepp",
"cell": "8125552344",
"city": "Pawnee",
"location": [ -86.536632, 39.170344 ]
}
ID first_name last_name cell city latitude longitude
1 Leslie Yepp 8125552344 Pawnee 39.170344 -86.536632
UsersUsers
ID user_id hobby
10 1 scrapbooking
11 1 eating waffles
12 1 working
Hobbies
@Lauren_Schaefer #ndcoslo
{
"_id": 1,
"first_name": "Leslie",
"last_name": "Yepp",
"cell": "8125552344",
"city": "Pawnee",
"location": [ -86.536632, 39.170344 ],
"hobbies": [
"scrapbooking",
"eating waffles",
"working”
]
}
ID first_name last_name cell city latitude longitude
1 Leslie Yepp 8125552344 Pawnee 39.170344 -86.536632
UsersUsers
ID user_id hobby
10 1 scrapbooking
11 1 eating waffles
12 1 working
Hobbies
@Lauren_Schaefer #ndcoslo
{
"_id": 1,
"first_name": "Leslie",
"last_name": "Yepp",
"cell": "8125552344",
"city": "Pawnee",
"location": [ -86.536632, 39.170344 ],
"hobbies": [
"scrapbooking",
"eating waffles",
"working”
]
}
ID first_name last_name cell city latitude longitude
1 Leslie Yepp 8125552344 Pawnee 39.170344 -86.536632
UsersUsers
ID user_id hobby
10 1 scrapbooking
11 1 eating waffles
12 1 working
Hobbies
@Lauren_Schaefer #ndcoslo
{
"_id": 1,
"first_name": "Leslie",
"last_name": "Yepp",
"cell": "8125552344",
"city": "Pawnee",
"location": [ -86.536632, 39.170344 ],
"hobbies": [
"scrapbooking",
"eating waffles",
"working”
]
}
ID first_name last_name cell city latitude longitude
1 Leslie Yepp 8125552344 Pawnee 39.170344 -86.536632
UsersUsers
ID user_id hobby
10 1 scrapbooking
11 1 eating waffles
12 1 working
Hobbies
ID user_id job_title year_started
20 1 Deputy Directory 2004
21 1 City Councilor 2012
22 1 Director, National
Parks Service,
Midwest Branch
2014
JobHistory
@Lauren_Schaefer #ndcoslo
{
"_id": 1,
"first_name": "Leslie",
"last_name": "Yepp",
"cell": "8125552344",
"city": "Pawnee",
"location": [ -86.536632, 39.170344 ],
"hobbies": [
"scrapbooking",
"eating waffles",
"working”
]
}
ID first_name last_name cell city latitude longitude
1 Leslie Yepp 8125552344 Pawnee 39.170344 -86.536632
UsersUsers
ID user_id hobby
10 1 scrapbooking
11 1 eating waffles
12 1 working
Hobbies
ID user_id job_title year_started
20 1 Deputy Directory 2004
21 1 City Councilor 2012
22 1 Director, National
Parks Service,
Midwest Branch
2014
JobHistory
@Lauren_Schaefer #ndcoslo
{
"_id": 1,
"first_name": "Leslie",
"last_name": "Yepp",
"cell": "8125552344",
"city": "Pawnee",
"location": [ -86.536632, 39.170344 ],
"hobbies": [
"scrapbooking",
"eating waffles",
"working”
],
"jobHistory": [
{
"title": "Deputy Director",
"yearStarted": 2004
},
{
"title": "City Councillor",
"yearStarted": 2012
},
{
"title": "Director, National Parks
Service, Midwest Branch",
"yearStarted": 2014
}
]
}
ID first_name last_name cell city latitude longitude
1 Leslie Yepp 8125552344 Pawnee 39.170344 -86.536632
UsersUsers
ID user_id hobby
10 1 scrapbooking
11 1 eating waffles
12 1 working
Hobbies
ID user_id job_title year_started
20 1 Deputy Directory 2004
21 1 City Councilor 2012
22 1 Director, National
Parks Service,
Midwest Branch
2014
JobHistory
@Lauren_Schaefer #ndcoslo
{
"_id": 1,
"first_name": "Leslie",
"last_name": "Yepp",
"cell": "8125552344",
"city": "Pawnee",
"location": [ -86.536632, 39.170344 ],
"hobbies": [
"scrapbooking",
"eating waffles",
"working”
],
"jobHistory": [
{
"title": "Deputy Director",
"yearStarted": 2004
},
{
"title": "City Councillor",
"yearStarted": 2012
},
{
"title": "Director, National Parks
Service, Midwest Branch",
"yearStarted": 2014
}
]
}
ID first_name last_name cell city latitude longitude
1 Leslie Yepp 8125552344 Pawnee 39.170344 -86.536632
UsersUsers
ID user_id hobby
10 1 scrapbooking
11 1 eating waffles
12 1 working
Hobbies
ID user_id job_title year_started
20 1 Deputy Directory 2004
21 1 City Councilor 2012
22 1 Director, National
Parks Service,
Midwest Branch
2014
JobHistory
@Lauren_Schaefer #ndcoslo
{
"_id": 1,
"first_name": "Leslie",
"last_name": "Yepp",
"cell": "8125552344",
"city": "Pawnee",
"location": [ -86.536632, 39.170344 ],
"hobbies": [
"scrapbooking",
"eating waffles",
"working”
],
"jobHistory": [
{
"title": "Deputy Director",
"yearStarted": 2004
},
{
"title": "City Councillor",
"yearStarted": 2012
},
{
"title": "Director, National Parks
Service, Midwest Branch",
"yearStarted": 2014
}
]
}
ID first_name last_name cell city latitude longitude
1 Leslie Yepp 8125552344 Pawnee 39.170344 -86.536632
2 Ron Swandaughte
r
8125559347 Pawnee NULL NULL
UsersUsers
ID user_id hobby
10 1 scrapbooking
11 1 eating waffles
12 1 working
Hobbies
ID user_id job_title year_started
20 1 Deputy Directory 2004
21 1 City Councilor 2012
22 1 Director, National
Parks Service,
Midwest Branch
2014
JobHistory
@Lauren_Schaefer #ndcoslo
{
"_id": 1,
"first_name": "Leslie",
"last_name": "Yepp",
"cell": "8125552344",
"city": "Pawnee",
"location": [ -86.536632, 39.170344 ],
"hobbies": [
"scrapbooking",
"eating waffles",
"working”
],
"jobHistory": [
{
"title": "Deputy Director",
"yearStarted": 2004
},
{
"title": "City Councillor",
"yearStarted": 2012
},
{
"title": "Director, National Parks
Service, Midwest Branch",
"yearStarted": 2014
}
]
}
ID first_name last_name cell city latitude longitude
1 Leslie Yepp 8125552344 Pawnee 39.170344 -86.536632
2 Ron Swandaughte
r
8125559347 Pawnee NULL NULL
UsersUsers
ID user_id hobby
10 1 scrapbooking
11 1 eating waffles
12 1 working
Hobbies
ID user_id job_title year_started
20 1 Deputy Directory 2004
21 1 City Councilor 2012
22 1 Director, National
Parks Service,
Midwest Branch
2014
JobHistory
{
"_id": 1,
"first_name": "Ron",
"last_name": "Swandaughter",
"cell": "8125559347",
"city": "Pawnee"
}
@Lauren_Schaefer #ndcoslo
{
"_id": 1,
"first_name": "Leslie",
"last_name": "Yepp",
"cell": "8125552344",
"city": "Pawnee",
"location": [ -86.536632, 39.170344 ],
"hobbies": [
"scrapbooking",
"eating waffles",
"working”
],
"jobHistory": [
{
"title": "Deputy Director",
"yearStarted": 2004
},
{
"title": "City Councillor",
"yearStarted": 2012
},
{
"title": "Director, National Parks
Service, Midwest Branch",
"yearStarted": 2014
}
]
}
ID first_name last_name cell city latitude longitude
1 Leslie Yepp 8125552344 Pawnee 39.170344 -86.536632
2 Ron Swandaughte
r
8125559347 Pawnee NULL NULL
UsersUsers
ID user_id hobby
10 1 scrapbooking
11 1 eating waffles
12 1 working
13 2 woodworking
14 2 fishing
Hobbies
ID user_id job_title year_started
20 1 Deputy Directory 2004
21 1 City Councilor 2012
22 1 Director, National
Parks Service,
Midwest Branch
2014
23 2 Director 2002
24 2 CEO, Kinda Good
Building Company
2014
JobHistory
{
"_id": 1,
"first_name": "Ron",
"last_name": "Swandaughter",
"cell": "8125559347",
"city": "Pawnee"
}
@Lauren_Schaefer #ndcoslo
{
"_id": 1,
"first_name": "Leslie",
"last_name": "Yepp",
"cell": "8125552344",
"city": "Pawnee",
"location": [ -86.536632, 39.170344 ],
"hobbies": [
"scrapbooking",
"eating waffles",
"working”
],
"jobHistory": [
{
"title": "Deputy Director",
"yearStarted": 2004
},
{
"title": "City Councillor",
"yearStarted": 2012
},
{
"title": "Director, National Parks
Service, Midwest Branch",
"yearStarted": 2014
}
]
}
ID first_name last_name cell city latitude longitude
1 Leslie Yepp 8125552344 Pawnee 39.170344 -86.536632
2 Ron Swandaughte
r
8125559347 Pawnee NULL NULL
UsersUsers
ID user_id hobby
10 1 scrapbooking
11 1 eating waffles
12 1 working
13 2 woodworking
14 2 fishing
Hobbies
ID user_id job_title year_started
20 1 Deputy Directory 2004
21 1 City Councilor 2012
22 1 Director, National
Parks Service,
Midwest Branch
2014
23 2 Director 2002
24 2 CEO, Kinda Good
Building Company
2014
JobHistory
{
"_id": 1,
"first_name": "Ron",
"last_name": "Swandaughter",
"cell": "8125559347",
"city": "Pawnee",
"hobbies": [
"woodworking",
"fishing"
],
"jobHistory": [
{
"title": "Director",
"yearStarted": 2002
},
{
"title": "CEO, Kinda Good Building
Company",
"yearStarted": 2014
}
]
}
@Lauren_Schaefer #ndcoslo
{
"_id": 1,
"first_name": "Leslie",
"last_name": "Yepp",
"cell": "8125552344",
"city": "Pawnee",
"location": [ -86.536632, 39.170344 ],
"hobbies": [
"scrapbooking",
"eating waffles",
"working”
],
"jobHistory": [
{
"title": "Deputy Director",
"yearStarted": 2004
},
{
"title": "City Councillor",
"yearStarted": 2012
},
{
"title": "Director, National Parks
Service, Midwest Branch",
"yearStarted": 2014
}
]
}
ID first_name last_name cell city latitude longitude
1 Leslie Yepp 8125552344 Pawnee 39.170344 -86.536632
2 Ron Swandaughte
r
8125559347 Pawnee NULL NULL
UsersUsers
ID user_id hobby
10 1 scrapbooking
11 1 eating waffles
12 1 working
13 2 woodworking
14 2 fishing
Hobbies
ID user_id job_title year_started
20 1 Deputy Directory 2004
21 1 City Councilor 2012
22 1 Director, National
Parks Service,
Midwest Branch
2014
23 2 Director 2002
24 2 CEO, Kinda Good
Building Company
2014
JobHistory
{
"_id": 1,
"first_name": "Ron",
"last_name": "Swandaughter",
"cell": "8125559347",
"city": "Pawnee",
"hobbies": [
"woodworking",
"fishing"
],
"jobHistory": [
{
"title": "Director",
"yearStarted": 2002
},
{
"title": "CEO, Kinda Good Building
Company",
"yearStarted": 2014
}
]
}
@Lauren_Schaefer #ndcoslo
{
"_id": 1,
"first_name": "Leslie",
"last_name": "Yepp",
"cell": "8125552344",
"city": "Pawnee",
"location": [ -86.536632, 39.170344 ],
"hobbies": [
"scrapbooking",
"eating waffles",
"working”
],
"jobHistory": [
{
"title": "Deputy Director",
"yearStarted": 2004
},
{
"title": "City Councillor",
"yearStarted": 2012
},
{
"title": "Director, National Parks
Service, Midwest Branch",
"yearStarted": 2014
}
]
}
ID first_name last_name cell city latitude longitude
1 Leslie Yepp 8125552344 Pawnee 39.170344 -86.536632
2 Ron Swandaughte
r
8125559347 Pawnee NULL NULL
3 Lauren Burhug NULL Pawnee NULL NULL
UsersUsers
ID user_id hobby
10 1 scrapbooking
11 1 eating waffles
12 1 working
13 2 woodworking
14 2 fishing
15 3 soccer
Hobbies
ID user_id job_title year_started
20 1 Deputy Directory 2004
21 1 City Councilor 2012
22 1 Director, National
Parks Service,
Midwest Branch
2014
23 2 Director 2002
24 2 CEO, Kinda Good
Building Company
2014
JobHistory
{
"_id": 1,
"first_name": "Ron",
"last_name": "Swandaughter",
"cell": "8125559347",
"city": "Pawnee",
"hobbies": [
"woodworking",
"fishing"
],
"jobHistory": [
{
"title": "Director",
"yearStarted": 2002
},
{
"title": "CEO, Kinda Good Building
Company",
"yearStarted": 2014
}
]
}
@Lauren_Schaefer #ndcoslo
{
"_id": 1,
"first_name": "Leslie",
"last_name": "Yepp",
"cell": "8125552344",
"city": "Pawnee",
"location": [ -86.536632, 39.170344 ],
"hobbies": [
"scrapbooking",
"eating waffles",
"working”
],
"jobHistory": [
{
"title": "Deputy Director",
"yearStarted": 2004
},
{
"title": "City Councillor",
"yearStarted": 2012
},
{
"title": "Director, National Parks
Service, Midwest Branch",
"yearStarted": 2014
}
]
}
ID first_name last_name cell city latitude longitude
1 Leslie Yepp 8125552344 Pawnee 39.170344 -86.536632
2 Ron Swandaughte
r
8125559347 Pawnee NULL NULL
3 Lauren Burhug NULL Pawnee NULL NULL
UsersUsers
ID user_id hobby
10 1 scrapbooking
11 1 eating waffles
12 1 working
13 2 woodworking
14 2 fishing
15 3 soccer
Hobbies
ID user_id job_title year_started
20 1 Deputy Directory 2004
21 1 City Councilor 2012
22 1 Director, National
Parks Service,
Midwest Branch
2014
23 2 Director 2002
24 2 CEO, Kinda Good
Building Company
2014
JobHistory
{
"_id": 1,
"first_name": "Ron",
"last_name": "Swandaughter",
"cell": ”8125559347",
"city": "Pawnee",
"hobbies": [
”woodworking",
”fishing"
],
"jobHistory": [
{
"title": "Director",
"yearStarted": 2002
},
{
"title": ”CEO, Kinda Good Building Company",
"yearStarted": 2014
}
]
}
{
"_id": 3,
"first_name": "Lauren",
"last_name": "Burhug",
"city": "Pawnee",
"hobbies": [ "soccer" ]
}
@Lauren_Schaefer #ndcoslo
{
"_id": 1,
"first_name": "Leslie",
"last_name": "Yepp",
"cell": "8125552344",
"city": "Pawnee",
"location": [ -86.536632, 39.170344 ],
"hobbies": [
"scrapbooking",
"eating waffles",
"working”
],
"jobHistory": [
{
"title": "Deputy Director",
"yearStarted": 2004
},
{
"title": "City Councillor",
"yearStarted": 2012
},
{
"title": "Director, National Parks
Service, Midwest Branch",
"yearStarted": 2014
}
]
}
ID first_name last_name cell city latitude longitude
1 Leslie Yepp 8125552344 Pawnee 39.170344 -86.536632
2 Ron Swandaughte
r
8125559347 Pawnee NULL NULL
3 Lauren Burhug NULL Pawnee NULL NULL
UsersUsers
ID user_id hobby
10 1 scrapbooking
11 1 eating waffles
12 1 working
13 2 woodworking
14 2 fishing
15 3 soccer
Hobbies
ID user_id job_title year_started
20 1 Deputy Directory 2004
21 1 City Councilor 2012
22 1 Director, National
Parks Service,
Midwest Branch
2014
23 2 Director 2002
24 2 CEO, Kinda Good
Building Company
2014
JobHistory
{
"_id": 1,
"first_name": "Ron",
"last_name": "Swandaughter",
"cell": ”8125559347",
"city": "Pawnee",
"hobbies": [
”woodworking",
”fishing"
],
"jobHistory": [
{
"title": "Director",
"yearStarted": 2002
},
{
"title": ”CEO, Kinda Good Building Company",
"yearStarted": 2014
}
]
}
{
"_id": 3,
"first_name": "Lauren",
"last_name": "Burhug",
"city": "Pawnee",
"hobbies": [ "soccer" ]
}
@Lauren_Schaefer #ndcoslo
{
"_id": 1,
"first_name": "Leslie",
"last_name": "Yepp",
"cell": "8125552344",
"city": "Pawnee",
"location": [ -86.536632, 39.170344 ],
"hobbies": [
"scrapbooking",
"eating waffles",
"working”
],
"jobHistory": [
{
"title": "Deputy Director",
"yearStarted": 2004
},
{
"title": "City Councillor",
"yearStarted": 2012
},
{
"title": "Director, National Parks
Service, Midwest Branch",
"yearStarted": 2014
}
]
}
ID first_name last_name cell city latitude longitude
1 Leslie Yepp 8125552344 Pawnee 39.170344 -86.536632
2 Ron Swandaughte
r
8125559347 Pawnee NULL NULL
3 Lauren Burhug NULL Pawnee NULL NULL
UsersUsers
ID user_id hobby
10 1 scrapbooking
11 1 eating waffles
12 1 working
13 2 woodworking
14 2 fishing
15 3 soccer
Hobbies
ID user_id job_title year_started
20 1 Deputy Directory 2004
21 1 City Councilor 2012
22 1 Director, National
Parks Service,
Midwest Branch
2014
23 2 Director 2002
24 2 CEO, Kinda Good
Building Company
2014
JobHistory
{
"_id": 1,
"first_name": "Ron",
"last_name": "Swandaughter",
"cell": ”8125559347",
"city": "Pawnee",
"hobbies": [
”woodworking",
”fishing"
],
"jobHistory": [
{
"title": "Director",
"yearStarted": 2002
},
{
"title": ”CEO, Kinda Good Building Company",
"yearStarted": 2014
}
]
}
{
"_id": 3,
"first_name": "Lauren",
"last_name": "Burhug",
"city": "Pawnee",
"hobbies": [ "soccer" ]
}
@Lauren_Schaefer #ndcoslo
{
"_id": 1,
"first_name": "Leslie",
"last_name": "Yepp",
"cell": "8125552344",
"city": "Pawnee",
"location": [ -86.536632, 39.170344 ],
"hobbies": [
"scrapbooking",
"eating waffles",
"working”
],
"jobHistory": [
{
"title": "Deputy Director",
"yearStarted": 2004
},
{
"title": "City Councillor",
"yearStarted": 2012
},
{
"title": "Director, National Parks
Service, Midwest Branch",
"yearStarted": 2014
}
]
}
ID first_name last_name cell city latitude longitude school
1 Leslie Yepp 8125552344 Pawnee 39.170344 -86.536632 NULL
2 Ron Swandaughte
r
8125559347 Pawnee NULL NULL NULL
3 Lauren Burhug NULL Pawnee NULL NULL Pawnee
Elementar
y
UsersUsers
ID user_id hobby
10 1 scrapbooking
11 1 eating waffles
12 1 working
13 2 woodworking
14 2 fishing
15 3 soccer
Hobbies
ID user_id job_title year_started
20 1 Deputy Directory 2004
21 1 City Councilor 2012
22 1 Director, National
Parks Service,
Midwest Branch
2014
23 2 Director 2002
24 2 CEO, Kinda Good
Building Company
2014
JobHistory
{
"_id": 1,
"first_name": "Ron",
"last_name": "Swandaughter",
"cell": ”8125559347",
"city": "Pawnee",
"hobbies": [
”woodworking",
”fishing"
],
"jobHistory": [
{
"title": "Director",
"yearStarted": 2002
},
{
"title": ”CEO, Kinda Good Building Company",
"yearStarted": 2014
}
]
}
{
"_id": 3,
"first_name": "Lauren",
"last_name": "Burhug",
"city": "Pawnee",
"hobbies": [ "soccer" ]
}
@Lauren_Schaefer #ndcoslo
{
"_id": 1,
"first_name": "Leslie",
"last_name": "Yepp",
"cell": "8125552344",
"city": "Pawnee",
"location": [ -86.536632, 39.170344 ],
"hobbies": [
"scrapbooking",
"eating waffles",
"working”
],
"jobHistory": [
{
"title": "Deputy Director",
"yearStarted": 2004
},
{
"title": "City Councillor",
"yearStarted": 2012
},
{
"title": "Director, National Parks
Service, Midwest Branch",
"yearStarted": 2014
}
]
}
ID first_name last_name cell city latitude longitude school
1 Leslie Yepp 8125552344 Pawnee 39.170344 -86.536632 NULL
2 Ron Swandaughte
r
8125559347 Pawnee NULL NULL NULL
3 Lauren Burhug NULL Pawnee NULL NULL Pawnee
Elementar
y
UsersUsers
ID user_id hobby
10 1 scrapbooking
11 1 eating waffles
12 1 working
13 2 woodworking
14 2 fishing
15 3 soccer
Hobbies
ID user_id job_title year_started
20 1 Deputy Directory 2004
21 1 City Councilor 2012
22 1 Director, National
Parks Service,
Midwest Branch
2014
23 2 Director 2002
24 2 CEO, Kinda Good
Building Company
2014
JobHistory
{
"_id": 1,
"first_name": "Ron",
"last_name": "Swandaughter",
"cell": ”8125559347",
"city": "Pawnee",
"hobbies": [
”woodworking",
”fishing"
],
"jobHistory": [
{
"title": "Director",
"yearStarted": 2002
},
{
"title": ”CEO, Kinda Good Building Company",
"yearStarted": 2014
}
]
}
{
"_id": 3,
"first_name": "Lauren",
"last_name": "Burhug",
"city": "Pawnee",
"hobbies": [ "soccer" ]
}
@Lauren_Schaefer #ndcoslo
{
"_id": 1,
"first_name": "Leslie",
"last_name": "Yepp",
"cell": "8125552344",
"city": "Pawnee",
"location": [ -86.536632, 39.170344 ],
"hobbies": [
"scrapbooking",
"eating waffles",
"working”
],
"jobHistory": [
{
"title": "Deputy Director",
"yearStarted": 2004
},
{
"title": "City Councillor",
"yearStarted": 2012
},
{
"title": "Director, National Parks
Service, Midwest Branch",
"yearStarted": 2014
}
]
}
ID first_name last_name cell city latitude longitude school
1 Leslie Yepp 8125552344 Pawnee 39.170344 -86.536632 NULL
2 Ron Swandaughte
r
8125559347 Pawnee NULL NULL NULL
3 Lauren Burhug NULL Pawnee NULL NULL Pawnee
Elementar
y
UsersUsers
ID user_id hobby
10 1 scrapbooking
11 1 eating waffles
12 1 working
13 2 woodworking
14 2 fishing
15 3 soccer
Hobbies
ID user_id job_title year_started
20 1 Deputy Directory 2004
21 1 City Councilor 2012
22 1 Director, National
Parks Service,
Midwest Branch
2014
23 2 Director 2002
24 2 CEO, Kinda Good
Building Company
2014
JobHistory
{
"_id": 1,
"first_name": "Ron",
"last_name": "Swandaughter",
"cell": ”8125559347",
"city": "Pawnee",
"hobbies": [
”woodworking",
”fishing"
],
"jobHistory": [
{
"title": "Director",
"yearStarted": 2002
},
{
"title": ”CEO, Kinda Good Building Company",
"yearStarted": 2014
}
]
}
{
"_id": 3,
"first_name": "Lauren",
"last_name": "Burhug",
"city": "Pawnee",
"hobbies": [ "soccer" ],
"school": "Pawnee Elementary"
}
@Lauren_Schaefer #ndcoslo
FlexibleSchema
@Lauren_Schaefer #ndcoslo
FlexibleSchema
Don’t panic!
Use schema validation.
@Lauren_Schaefer #ndcoslo
@Lauren_Schaefer #ndcoslo
Row Document
{
...
a: “b”
...
}
ID a ...
1 b ...
2 ... ...
3 ... ...
@Lauren_Schaefer #ndcoslo
Row(s) Document
{
...
a: “b”
...
}
ID a ...
1 b ...
2 ... ...
3 ... ...
... ... ...
... ... ...
... ... ...
... ... ...
... ... ...
... ... ...
@Lauren_Schaefer #ndcoslo
Column Field
ID a ...
1 b ...
2 c ...
3 ... ...
{
...
a: “b”
...
}
{
...
a: “c”
...
}
@Lauren_Schaefer #ndcoslo
Table Collection
{
...
}
... ... ...
... ... ...
... ... ...
... ... ...
{
...
}
{
...
}
@Lauren_Schaefer #ndcoslo
Database Database
{
...
}
{
...
}
{
...
}
{
...
}
{
...
}
{
...
}
{
...
}
... ... ...
... ... ...
... ... ...
... ... ...
... ... ...
... ... ...
... ... ...
... ... ...
... ... ...
@Lauren_Schaefer #ndcoslo
Index Index
{
...
}
{
...
}
{
...
}
{
...
}
... ... ...
... ... ...
... ... ...
... ... ...
... ... ...
@Lauren_Schaefer #ndcoslo
View View
{
...
}
... ... ...
... ... ...
... ... ...
... ... ...
{
...
}
{
...
}
@Lauren_Schaefer #ndcoslo
Join Embedding
{
...
a: “b”,
...
c: {
d: “e”
...
},
...
}
ID a ...
1 b ...
2 ... ...
3 ... ...
... d ...
1 e ...
... ... ...
@Lauren_Schaefer #ndcoslo
Multi-Record
ACID Transaction
Multi-Document
ACID Transaction
{
...
}
{
...
}
{
...
}
{
...
}
{
...
}
{
...
}
{
...
}
... ... ...
... ... ...
... ... ...
... ... ...
... ... ...
... ... ...
... ... ...
@Lauren_Schaefer #ndcoslo
TermMappingSummary
Column
Field
Row
Document
Table
Collection
Database
Database
Index
Index
Join
Embedding
View
View
Transaction
Transaction
@Lauren_Schaefer #ndcoslo
Themental
journey from
tables to
documents
1. Map terms & concepts from tables to documents
2. Discover the 4 major advantages of documents
3. Change your mindset in 3 key ways
@Lauren_Schaefer #ndcoslo
@Lauren_Schaefer #ndcoslo
@Lauren_Schaefer #ndcoslo
Scalecheaper!
As the size of your database grows, scale horizontally.
@Lauren_Schaefer #ndcoslo
Queryfaster!
Stop doing expensive joins to get your data.
Tabular Database
ID a ...
1 b ...
2 ... ...
3 ... ...
... ... ...
... ... ...
... ... ...
... ... ...
... ... ...
... ... ...
Document Database
{
...
a: “b”,
...
c: {
d: “e”
...
},
...
}
@Lauren_Schaefer #ndcoslo
Pivoteasier!
Easily change the shape of your data as your app evolves.
Document Database
{
first_name:
“Lauren”,
…
}
{
first_name:
“Lauren”,
school: “Pawnee
Elementary”,
…
}
Relational Database
ALTER TABLE `CityHall`.`Users`
ADD COLUMN `school` VARCHAR(45) NULL AFTER
`longitude`;
@Lauren_Schaefer #ndcoslo
Programfaster!
Documents map to data structures in most popular languages.
@Lauren_Schaefer #ndcoslo
{
"_id": 1,
"first_name": "Leslie",
"last_name": "Yepp",
"cell": "8125552344",
"city": "Pawnee",
"location": [ -86.536632, 39.170344 ],
"hobbies": [
"scrapbooking",
"eating waffles",
"working”
]
}
ID first_name last_name cell city latitude longitude school
1 Leslie Yepp 812555234
4
Pawnee 39.170344 -86.536632 NULL
UsersUsers
ID user_id hobby
10 1 scrapbooking
11 1 eating waffles
12 1 working
Hobbies
Programfaster!
@Lauren_Schaefer #ndcoslo
import mysql.connector
# CONNECT TO THE DB
mydb = mysql.connector.connect(
host="localhost",
user="root",
passwd="rootroot",
database="CityHall" )
mycursor =
mydb.cursor(dictionary=True)
# THE ID OF THE USER WHOSE PROFILE WE
# WILL BE RETRIEVING AND UPDATING
userId = 1
import pymongo
from pymongo import MongoClient
# CONNECT TO THE DB
client = MongoClient()
client = pymongo
.MongoClient("mongodb+srv://root:rootro
ot@mycluster.mongodb.net/test?retryWrit
es=true&w=majority")
db = client.CityHall
# THE ID OF THE USER WHOSE PROFILE WE
# WILL BE RETRIEVING AND UPDATING
userId = 1
Programfaster!
sql = "SELECT * FROM Users LEFT JOIN
Hobbies ON Users.ID = Hobbies.user_id
WHERE Users.id=%s"
values = (userId,)
my cursor.execute(sql, values)
user = mycursor.fetchone()
user = db['Users’]
.find_one({"_id": userId})
Programfaster!
hobbies = []
if (user["hobby"]):
hobbies.append(user["hobby"])
del user["hobby"]
del user["ID"]
for result in mycursor:
hobbies.append(result["hobby"])
user["hobbies"] = hobbies
{
'city': 'Pawnee',
'first_name': 'Leslie',
'last_name': 'Yepp',
'school': None,
'cell': '8125552344',
'latitude': 39.1703,
'longitude': -86.5366,3
'hobbies’: [
'scrapbooking’,
'eating waffles’,
'working’
],
'user_id': 1
}
{
'city': 'Pawnee',
'first_name’: 'Leslie',
'last_name': 'Yepp',
'cell': '8125552344',
'location': [-86.536632, 39.170344],
'hobbies’: [
'scrapbooking’,
'eating waffles’,
'working’
],
'_id': 1
}
Programfaster!
user.update( {
"city": "Washington, DC",
"latitude": 38.897760,
"longitude": -77.036809,
"hobbies": [
"scrapbooking",
"eating waffles",
"signing bills"]
} )
user.update( {
"city": "Washington, DC",
"location": [-77.036809,
38.897760],
"hobbies": [
"scrapbooking",
"eating waffles",
"signing bills"]
} )
Programfaster!
sql = "UPDATE Users SET first_name=%s,
last_name=%s, cell=%s, city=%s,
latitude=%s, longitude=%s, school=%s
WHERE (ID=%s)"
values = (user["first_name"],
user["last_name"], user["cell"],
user["city"], user["latitude"],
user["longitude"], user["school"],
userId)
mycursor.execute(sql, values)
mydb.commit()
result = db['Users’]
.update_one(
{"_id": userId},
{"$set": user})
Programfaster!
sql = "DELETE FROM Hobbies WHERE
user_id=%s"
values = (userId,)
mycursor.execute(sql, values)
mydb.commit()
if(len(user["hobbies"]) > 0):
sql = "INSERT INTO Hobbies
(user_id, hobby) VALUES (%s, %s)"
values = []
for hobby in user["hobbies"]:
values.append((userId, hobby))
mycursor.executemany(sql,values)
mydb.commit()
27 lines of code 2 lines of code
4major
advantagesof
documents
 Scale cheaper
 Query faster
 Pivot easier
 Program faster
@Lauren_Schaefer #ndcoslo
Themental
journey from
tables to
documents
1. Map terms & concepts from tables to documents
2. Discover the 4 major advantages of documents
3. Change your mindset in 3 key ways
@Lauren_Schaefer #ndcoslo
@Lauren_Schaefer #ndcoslo
@Lauren_Schaefer #ndcoslo
Embracedocumentdiversity
@Lauren_Schaefer #ndcoslo
Embracedocumentdiversity
The Polymorphic Pattern
{
"_id": 1,
"first_name": "Leslie",
"last_name": "Yepp",
"cell": "8125552344",
"city": "Pawnee",
"location": [ -86.536632, 39.170344 ],
"hobbies": [
"scrapbooking",
"eating waffles",
"working”
],
"jobHistory": [
{
"title": "Deputy Director",
"yearStarted": 2004
},
{
"title": "City Councillor",
"yearStarted": 2012
},
{
"title": "Director, National Parks
Service, Midwest Branch",
"yearStarted": 2014
}
]
}
{
"_id": 1,
"first_name": "Ron",
"last_name": "Swandaughter",
"cell": ”8125559347",
"city": "Pawnee",
"hobbies": [
”woodworking",
”fishing"
],
"jobHistory": [
{
"title": "Director",
"yearStarted": 2002
},
{
"title": ”CEO, Kinda Good Building Company",
"yearStarted": 2014
}
]
}
{
"_id": 3,
"first_name": "Lauren",
"last_name": "Burhug",
"city": "Pawnee",
"hobbies": [ "soccer" ],
"school": "Pawnee Elementary"
}
@Lauren_Schaefer #ndcoslo
Embracedocumentdiversity
The Outlier Pattern
{
"_id": 3,
"first_name": "Lauren",
"last_name": "Burhug",
"city": "Pawnee",
"hobbies": ["soccer"],
"school": "Pawnee Elementary",
"followers": [
"Brandon",
"Wesley",
"Ciara",
...
]
}
{
"_id": 2,
"first_name": "Ron",
"last_name": "Swandaughter",
"cell": "8125559347",
"city": "Pawnee",
"hobbies": [
"woodworking",
"fishing"],
"jobHistory": [
{
"title": "Director",
"yearStarted": 2002
},
...
],
"followers": [
"Leslie",
"Donna",
"Tom" ... ],
"has_extras": true
}
{
"_id": 2.1,
"followers": [
"Jerry",
"Ann",
"Ben"
...
],
"is_overflow": true
}
@Lauren_Schaefer #ndcoslo
Datathatisaccessedtogethershouldbestoredtogether
@Lauren_Schaefer #ndcoslo
Datathatisaccessedtogethershouldbestoredtogether
@Lauren_Schaefer #ndcoslo
Datathatisaccessedtogethershouldbestoredtogether
100000
1
30000
100000
0
20000
40000
60000
80000
100000
120000
1985 2017
Storage vs Developer Costs
Storage Cost per GB Developer Salary
@Lauren_Schaefer #ndcoslo
Datathatisaccessedtogethershouldbestoredtogether
Don’t normalize your data for the sake of normalizing it.
{
a: “b”,
c: {
d: “e”
...
},
f: [“g”, “h”, “i”],
j: [
{
k: “l”
},
{
m: “n”
}
]
} @Lauren_Schaefer #ndcoslo
Treadcarefullywithtransactions
Relying on transactions is a bad design smell.
{
...
}
{
...
}
{
...
}
{
...
}
{
...
}
{
...
}
{
...
}
@Lauren_Schaefer #ndcoslo
Changeyour
mindsetin
3keyways
 Embrace document diversity
 Data that is accessed together should be stored together
 Tread carefully with transactions
@Lauren_Schaefer #ndcoslo
Themental
journey from
tables to
documents
@Lauren_Schaefer #ndcoslo
Themental
journey from
tables to
documents
1. Map terms & concepts from tables to documents
@Lauren_Schaefer #ndcoslo
Themental
journey from
tables to
documents
1. Map terms & concepts from tables to documents
2. Discover the 4 major advantages of documents
@Lauren_Schaefer #ndcoslo
Themental
journey from
tables to
documents
1. Map terms & concepts from tables to documents
2. Discover the 4 major advantages of documents
1. Scale cheaper
@Lauren_Schaefer #ndcoslo
Themental
journey from
tables to
documents
1. Map terms & concepts from tables to documents
2. Discover the 4 major advantages of documents
1. Scale cheaper
2. Query faster
@Lauren_Schaefer #ndcoslo
Themental
journey from
tables to
documents
1. Map terms & concepts from tables to documents
2. Discover the 4 major advantages of documents
1. Scale cheaper
2. Query faster
3. Pivot easier
@Lauren_Schaefer #ndcoslo
Themental
journey from
tables to
documents
1. Map terms & concepts from tables to documents
2. Discover the 4 major advantages of documents
1. Scale cheaper
2. Query faster
3. Pivot easier
4. Program faster
@Lauren_Schaefer #ndcoslo
Themental
journey from
tables to
documents
1. Map terms & concepts from tables to documents
2. Discover the 4 major advantages of documents
3. Change your mindset in 3 key ways
@Lauren_Schaefer #ndcoslo
Themental
journey from
tables to
documents
1. Map terms & concepts from tables to documents
2. Discover the 4 major advantages of documents
3. Change your mindset in 3 key ways
1. Embrace document diversity
@Lauren_Schaefer #ndcoslo
Themental
journey from
tables to
documents
1. Map terms & concepts from tables to documents
2. Discover the 4 major advantages of documents
3. Change your mindset in 3 key ways
1. Embrace document diversity
2. Data that is accessed together should be stored together
{
a: “b”,
c: {
d: “e”
...
},
f: [“g”, “h”, “i”]
}
@Lauren_Schaefer #ndcoslo
Themental
journey from
tables to
documents
1. Map terms & concepts from tables to documents
2. Discover the 4 major advantages of documents
3. Change your mindset in 3 key ways
1. Embrace document diversity
2. Data that is accessed together should be stored together
3. Tread carefully with transactions
@Lauren_Schaefer #ndcoslo
Don’tbe
RonSwanson
(in this particular case)
@Lauren_Schaefer #ndcoslo
Changeyour
mindset&
getthefullvalueof
document
databases
@Lauren_Schaefer #ndcoslo
Additional
Resources
• SQL to MongoDB Blog (blog series)
• Quick Start: MongoDB and Node.js (blog series)
• Advanced Schema Design Patterns (webinar)
• Building with Patterns: A Summary (blog series)
• M320: Data Modeling (MongoDB University Course)
• JSON Schema Validation – Locking down your model
the smart way (blog)
@Lauren_Schaefer #ndcoslo
Changeyour
mindset&
getthefullvalueof
document
databases
Give document databases a try using MongoDB Atlas
Get the slides on my Twitter page: @Lauren_Schaefer @Lauren_Schaefer #ndcoslo

More Related Content

More from Lauren Hayward Schaefer

Developer Advocacy: A Career Path for Those With a Passion for Code, Communit...
Developer Advocacy: A Career Path for Those With a Passion for Code, Communit...Developer Advocacy: A Career Path for Those With a Passion for Code, Communit...
Developer Advocacy: A Career Path for Those With a Passion for Code, Communit...Lauren Hayward Schaefer
 
10 Best Practices for Writing Documentation (For Those Who Would Rather Do An...
10 Best Practices for Writing Documentation (For Those Who Would Rather Do An...10 Best Practices for Writing Documentation (For Those Who Would Rather Do An...
10 Best Practices for Writing Documentation (For Those Who Would Rather Do An...Lauren Hayward Schaefer
 
Intro to Technical Writing: Creating Content that Google and Readers will Love
Intro to Technical Writing: Creating Content that Google and Readers will LoveIntro to Technical Writing: Creating Content that Google and Readers will Love
Intro to Technical Writing: Creating Content that Google and Readers will LoveLauren Hayward Schaefer
 
Level Up Your Technical Career by Writing
Level Up Your Technical Career by WritingLevel Up Your Technical Career by Writing
Level Up Your Technical Career by WritingLauren Hayward Schaefer
 
5 Things I Learned While Modeling Data in MongoDB
5 Things I Learned While Modeling Data in MongoDB5 Things I Learned While Modeling Data in MongoDB
5 Things I Learned While Modeling Data in MongoDBLauren Hayward Schaefer
 
How to Raise Your Profile as a Developer (And Why You Should Bother!)
How to Raise Your Profile as a Developer (And Why You Should Bother!)How to Raise Your Profile as a Developer (And Why You Should Bother!)
How to Raise Your Profile as a Developer (And Why You Should Bother!)Lauren Hayward Schaefer
 
Building CI/CD Pipelines for MongoDB Realm Apps
Building CI/CD Pipelines for MongoDB Realm AppsBuilding CI/CD Pipelines for MongoDB Realm Apps
Building CI/CD Pipelines for MongoDB Realm AppsLauren Hayward Schaefer
 
DevOps + MongoDB Realm Serverless Functions = 🤩
DevOps + MongoDB Realm Serverless Functions = 🤩DevOps + MongoDB Realm Serverless Functions = 🤩
DevOps + MongoDB Realm Serverless Functions = 🤩Lauren Hayward Schaefer
 
Stop! Don't make these mistakes in your document database!
Stop! Don't make these mistakes in your document database!Stop! Don't make these mistakes in your document database!
Stop! Don't make these mistakes in your document database!Lauren Hayward Schaefer
 
Jumpstart! From SQL to NoSQL -- Changing Your Mindset
Jumpstart! From SQL to NoSQL -- Changing Your MindsetJumpstart! From SQL to NoSQL -- Changing Your Mindset
Jumpstart! From SQL to NoSQL -- Changing Your MindsetLauren Hayward Schaefer
 
From SQL to NoSQL -- Changing Your Mindset
From SQL to NoSQL -- Changing Your MindsetFrom SQL to NoSQL -- Changing Your Mindset
From SQL to NoSQL -- Changing Your MindsetLauren Hayward Schaefer
 
Look, Ma! No servers! Serverless application development with MongoDB Stitch
Look, Ma! No servers! Serverless application development with MongoDB StitchLook, Ma! No servers! Serverless application development with MongoDB Stitch
Look, Ma! No servers! Serverless application development with MongoDB StitchLauren Hayward Schaefer
 
Jumpstart! Building Your First MongoDB App Using Atlas & Stitch
Jumpstart! Building Your First MongoDB App Using Atlas & StitchJumpstart! Building Your First MongoDB App Using Atlas & Stitch
Jumpstart! Building Your First MongoDB App Using Atlas & StitchLauren Hayward Schaefer
 

More from Lauren Hayward Schaefer (20)

Developer Advocacy: A Career Path for Those With a Passion for Code, Communit...
Developer Advocacy: A Career Path for Those With a Passion for Code, Communit...Developer Advocacy: A Career Path for Those With a Passion for Code, Communit...
Developer Advocacy: A Career Path for Those With a Passion for Code, Communit...
 
10 Best Practices for Writing Documentation (For Those Who Would Rather Do An...
10 Best Practices for Writing Documentation (For Those Who Would Rather Do An...10 Best Practices for Writing Documentation (For Those Who Would Rather Do An...
10 Best Practices for Writing Documentation (For Those Who Would Rather Do An...
 
Intro to Technical Writing: Creating Content that Google and Readers will Love
Intro to Technical Writing: Creating Content that Google and Readers will LoveIntro to Technical Writing: Creating Content that Google and Readers will Love
Intro to Technical Writing: Creating Content that Google and Readers will Love
 
Level Up Your Technical Career by Writing
Level Up Your Technical Career by WritingLevel Up Your Technical Career by Writing
Level Up Your Technical Career by Writing
 
How to Raise Your Profile Worksheet
How to Raise Your Profile WorksheetHow to Raise Your Profile Worksheet
How to Raise Your Profile Worksheet
 
5 Things I Learned While Modeling Data in MongoDB
5 Things I Learned While Modeling Data in MongoDB5 Things I Learned While Modeling Data in MongoDB
5 Things I Learned While Modeling Data in MongoDB
 
How to Raise Your Profile as a Developer (And Why You Should Bother!)
How to Raise Your Profile as a Developer (And Why You Should Bother!)How to Raise Your Profile as a Developer (And Why You Should Bother!)
How to Raise Your Profile as a Developer (And Why You Should Bother!)
 
Building CI/CD Pipelines for MongoDB Realm Apps
Building CI/CD Pipelines for MongoDB Realm AppsBuilding CI/CD Pipelines for MongoDB Realm Apps
Building CI/CD Pipelines for MongoDB Realm Apps
 
DevOps + MongoDB Realm Serverless Functions = 🤩
DevOps + MongoDB Realm Serverless Functions = 🤩DevOps + MongoDB Realm Serverless Functions = 🤩
DevOps + MongoDB Realm Serverless Functions = 🤩
 
Stop! Don't make these mistakes in your document database!
Stop! Don't make these mistakes in your document database!Stop! Don't make these mistakes in your document database!
Stop! Don't make these mistakes in your document database!
 
Making #RemoteWork Actually Work
Making #RemoteWork Actually WorkMaking #RemoteWork Actually Work
Making #RemoteWork Actually Work
 
DevOps + MongoDB Serverless = 
DevOps + MongoDB Serverless = DevOps + MongoDB Serverless = 
DevOps + MongoDB Serverless = 
 
MongoDB: Back to Basics
MongoDB:  Back to BasicsMongoDB:  Back to Basics
MongoDB: Back to Basics
 
Intro to MongoDB Workshop
Intro to MongoDB WorkshopIntro to MongoDB Workshop
Intro to MongoDB Workshop
 
Jumpstart! From SQL to NoSQL -- Changing Your Mindset
Jumpstart! From SQL to NoSQL -- Changing Your MindsetJumpstart! From SQL to NoSQL -- Changing Your Mindset
Jumpstart! From SQL to NoSQL -- Changing Your Mindset
 
Does remote work *really* work?
Does remote work *really* work?Does remote work *really* work?
Does remote work *really* work?
 
From SQL to NoSQL -- Changing Your Mindset
From SQL to NoSQL -- Changing Your MindsetFrom SQL to NoSQL -- Changing Your Mindset
From SQL to NoSQL -- Changing Your Mindset
 
Look, Ma! No servers! Serverless application development with MongoDB Stitch
Look, Ma! No servers! Serverless application development with MongoDB StitchLook, Ma! No servers! Serverless application development with MongoDB Stitch
Look, Ma! No servers! Serverless application development with MongoDB Stitch
 
Does remote work *really* work?
Does remote work *really* work?Does remote work *really* work?
Does remote work *really* work?
 
Jumpstart! Building Your First MongoDB App Using Atlas & Stitch
Jumpstart! Building Your First MongoDB App Using Atlas & StitchJumpstart! Building Your First MongoDB App Using Atlas & Stitch
Jumpstart! Building Your First MongoDB App Using Atlas & Stitch
 

Recently uploaded

Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) SolutionIntroducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) SolutionOnePlan Solutions
 
Chinsurah Escorts ☎️8617697112 Starting From 5K to 15K High Profile Escorts ...
Chinsurah Escorts ☎️8617697112  Starting From 5K to 15K High Profile Escorts ...Chinsurah Escorts ☎️8617697112  Starting From 5K to 15K High Profile Escorts ...
Chinsurah Escorts ☎️8617697112 Starting From 5K to 15K High Profile Escorts ...Nitya salvi
 
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesVictorSzoltysek
 
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
 
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...SelfMade bd
 
The title is not connected to what is inside
The title is not connected to what is insideThe title is not connected to what is inside
The title is not connected to what is insideshinachiaurasa2
 
BUS PASS MANGEMENT SYSTEM USING PHP.pptx
BUS PASS MANGEMENT SYSTEM USING PHP.pptxBUS PASS MANGEMENT SYSTEM USING PHP.pptx
BUS PASS MANGEMENT SYSTEM USING PHP.pptxalwaysnagaraju26
 
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdfAzure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdfryanfarris8
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplatePresentation.STUDIO
 
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
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providermohitmore19
 
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
Direct Style Effect Systems -The Print[A] Example- A Comprehension AidDirect Style Effect Systems -The Print[A] Example- A Comprehension Aid
Direct Style Effect Systems - The Print[A] Example - A Comprehension AidPhilip Schwarz
 
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdfPayment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdfkalichargn70th171
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfkalichargn70th171
 
The Top App Development Trends Shaping the Industry in 2024-25 .pdf
The Top App Development Trends Shaping the Industry in 2024-25 .pdfThe Top App Development Trends Shaping the Industry in 2024-25 .pdf
The Top App Development Trends Shaping the Industry in 2024-25 .pdfayushiqss
 
%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrandmasabamasaba
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsJhone kinadey
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comFatema Valibhai
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxComplianceQuest1
 

Recently uploaded (20)

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
 
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) SolutionIntroducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
 
Chinsurah Escorts ☎️8617697112 Starting From 5K to 15K High Profile Escorts ...
Chinsurah Escorts ☎️8617697112  Starting From 5K to 15K High Profile Escorts ...Chinsurah Escorts ☎️8617697112  Starting From 5K to 15K High Profile Escorts ...
Chinsurah Escorts ☎️8617697112 Starting From 5K to 15K High Profile Escorts ...
 
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
 
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
 
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
 
The title is not connected to what is inside
The title is not connected to what is insideThe title is not connected to what is inside
The title is not connected to what is inside
 
BUS PASS MANGEMENT SYSTEM USING PHP.pptx
BUS PASS MANGEMENT SYSTEM USING PHP.pptxBUS PASS MANGEMENT SYSTEM USING PHP.pptx
BUS PASS MANGEMENT SYSTEM USING PHP.pptx
 
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdfAzure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation Template
 
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...
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
 
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
Direct Style Effect Systems -The Print[A] Example- A Comprehension AidDirect Style Effect Systems -The Print[A] Example- A Comprehension Aid
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
 
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdfPayment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
 
The Top App Development Trends Shaping the Industry in 2024-25 .pdf
The Top App Development Trends Shaping the Industry in 2024-25 .pdfThe Top App Development Trends Shaping the Industry in 2024-25 .pdf
The Top App Development Trends Shaping the Industry in 2024-25 .pdf
 
%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial Goals
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.com
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docx
 

From Tables to Documents -- Changing Your Database Mindset

  • 1. From Tables to Documents— Changing Your Database Mindset Lauren Schaefer, Developer Advocate, MongoDB
  • 2. Parks and Recreation, Season 6, Episode 14 @Lauren_Schaefer #ndcoslo
  • 6. Parks and Recreation, Season 6, Episode 14 @Lauren_Schaefer #ndcoslo
  • 8. From Tables to Documents Changing Your Database Mindset @Lauren_Schaefer #ndcoslo
  • 9. Themental journey from tables to documents 1. Map terms & concepts from tables to documents 2. Discover the 4 major advantages of documents 3. Change your mindset in 3 key ways @Lauren_Schaefer #ndcoslo
  • 10. Themental journey from tables to documents 1. Map terms & concepts from tables to documents 2. Discover the 4 major advantages of documents 3. Change your mindset in 3 key ways @Lauren_Schaefer #ndcoslo
  • 14. Let’s talk about documents { field: value, field: value, field: value } @Lauren_Schaefer #ndcoslo
  • 16. ID first_name last_name cell city 1 Leslie Yepp 8125552344 Pawnee Users @Lauren_Schaefer #ndcoslo
  • 17. { "_id": 1, "first_name": "Leslie", "last_name": "Yepp", "cell": "8125552344", "city": "Pawnee" } ID first_name last_name cell city 1 Leslie Yepp 8125552344 Pawnee UsersUsers @Lauren_Schaefer #ndcoslo
  • 18. { "_id": 1, "first_name": "Leslie", "last_name": "Yepp", "cell": "8125552344", "city": "Pawnee" } ID first_name last_name cell city latitude longitude 1 Leslie Yepp 8125552344 Pawnee 39.170344 -86.536632 UsersUsers @Lauren_Schaefer #ndcoslo
  • 19. { "_id": 1, "first_name": "Leslie", "last_name": "Yepp", "cell": "8125552344", "city": "Pawnee", "location": [ -86.536632, 39.170344 ] } ID first_name last_name cell city latitude longitude 1 Leslie Yepp 8125552344 Pawnee 39.170344 -86.536632 UsersUsers @Lauren_Schaefer #ndcoslo
  • 20. { "_id": 1, "first_name": "Leslie", "last_name": "Yepp", "cell": "8125552344", "city": "Pawnee", "location": [ -86.536632, 39.170344 ] } ID first_name last_name cell city latitude longitude 1 Leslie Yepp 8125552344 Pawnee 39.170344 -86.536632 UsersUsers @Lauren_Schaefer #ndcoslo
  • 21. { "_id": 1, "first_name": "Leslie", "last_name": "Yepp", "cell": "8125552344", "city": "Pawnee", "location": [ -86.536632, 39.170344 ] } ID first_name last_name cell city latitude longitude 1 Leslie Yepp 8125552344 Pawnee 39.170344 -86.536632 UsersUsers ID user_id hobby 10 1 scrapbooking 11 1 eating waffles 12 1 working Hobbies @Lauren_Schaefer #ndcoslo
  • 22. { "_id": 1, "first_name": "Leslie", "last_name": "Yepp", "cell": "8125552344", "city": "Pawnee", "location": [ -86.536632, 39.170344 ], "hobbies": [ "scrapbooking", "eating waffles", "working” ] } ID first_name last_name cell city latitude longitude 1 Leslie Yepp 8125552344 Pawnee 39.170344 -86.536632 UsersUsers ID user_id hobby 10 1 scrapbooking 11 1 eating waffles 12 1 working Hobbies @Lauren_Schaefer #ndcoslo
  • 23. { "_id": 1, "first_name": "Leslie", "last_name": "Yepp", "cell": "8125552344", "city": "Pawnee", "location": [ -86.536632, 39.170344 ], "hobbies": [ "scrapbooking", "eating waffles", "working” ] } ID first_name last_name cell city latitude longitude 1 Leslie Yepp 8125552344 Pawnee 39.170344 -86.536632 UsersUsers ID user_id hobby 10 1 scrapbooking 11 1 eating waffles 12 1 working Hobbies @Lauren_Schaefer #ndcoslo
  • 24. { "_id": 1, "first_name": "Leslie", "last_name": "Yepp", "cell": "8125552344", "city": "Pawnee", "location": [ -86.536632, 39.170344 ], "hobbies": [ "scrapbooking", "eating waffles", "working” ] } ID first_name last_name cell city latitude longitude 1 Leslie Yepp 8125552344 Pawnee 39.170344 -86.536632 UsersUsers ID user_id hobby 10 1 scrapbooking 11 1 eating waffles 12 1 working Hobbies ID user_id job_title year_started 20 1 Deputy Directory 2004 21 1 City Councilor 2012 22 1 Director, National Parks Service, Midwest Branch 2014 JobHistory @Lauren_Schaefer #ndcoslo
  • 25. { "_id": 1, "first_name": "Leslie", "last_name": "Yepp", "cell": "8125552344", "city": "Pawnee", "location": [ -86.536632, 39.170344 ], "hobbies": [ "scrapbooking", "eating waffles", "working” ] } ID first_name last_name cell city latitude longitude 1 Leslie Yepp 8125552344 Pawnee 39.170344 -86.536632 UsersUsers ID user_id hobby 10 1 scrapbooking 11 1 eating waffles 12 1 working Hobbies ID user_id job_title year_started 20 1 Deputy Directory 2004 21 1 City Councilor 2012 22 1 Director, National Parks Service, Midwest Branch 2014 JobHistory @Lauren_Schaefer #ndcoslo
  • 26. { "_id": 1, "first_name": "Leslie", "last_name": "Yepp", "cell": "8125552344", "city": "Pawnee", "location": [ -86.536632, 39.170344 ], "hobbies": [ "scrapbooking", "eating waffles", "working” ], "jobHistory": [ { "title": "Deputy Director", "yearStarted": 2004 }, { "title": "City Councillor", "yearStarted": 2012 }, { "title": "Director, National Parks Service, Midwest Branch", "yearStarted": 2014 } ] } ID first_name last_name cell city latitude longitude 1 Leslie Yepp 8125552344 Pawnee 39.170344 -86.536632 UsersUsers ID user_id hobby 10 1 scrapbooking 11 1 eating waffles 12 1 working Hobbies ID user_id job_title year_started 20 1 Deputy Directory 2004 21 1 City Councilor 2012 22 1 Director, National Parks Service, Midwest Branch 2014 JobHistory @Lauren_Schaefer #ndcoslo
  • 27. { "_id": 1, "first_name": "Leslie", "last_name": "Yepp", "cell": "8125552344", "city": "Pawnee", "location": [ -86.536632, 39.170344 ], "hobbies": [ "scrapbooking", "eating waffles", "working” ], "jobHistory": [ { "title": "Deputy Director", "yearStarted": 2004 }, { "title": "City Councillor", "yearStarted": 2012 }, { "title": "Director, National Parks Service, Midwest Branch", "yearStarted": 2014 } ] } ID first_name last_name cell city latitude longitude 1 Leslie Yepp 8125552344 Pawnee 39.170344 -86.536632 UsersUsers ID user_id hobby 10 1 scrapbooking 11 1 eating waffles 12 1 working Hobbies ID user_id job_title year_started 20 1 Deputy Directory 2004 21 1 City Councilor 2012 22 1 Director, National Parks Service, Midwest Branch 2014 JobHistory @Lauren_Schaefer #ndcoslo
  • 28. { "_id": 1, "first_name": "Leslie", "last_name": "Yepp", "cell": "8125552344", "city": "Pawnee", "location": [ -86.536632, 39.170344 ], "hobbies": [ "scrapbooking", "eating waffles", "working” ], "jobHistory": [ { "title": "Deputy Director", "yearStarted": 2004 }, { "title": "City Councillor", "yearStarted": 2012 }, { "title": "Director, National Parks Service, Midwest Branch", "yearStarted": 2014 } ] } ID first_name last_name cell city latitude longitude 1 Leslie Yepp 8125552344 Pawnee 39.170344 -86.536632 2 Ron Swandaughte r 8125559347 Pawnee NULL NULL UsersUsers ID user_id hobby 10 1 scrapbooking 11 1 eating waffles 12 1 working Hobbies ID user_id job_title year_started 20 1 Deputy Directory 2004 21 1 City Councilor 2012 22 1 Director, National Parks Service, Midwest Branch 2014 JobHistory @Lauren_Schaefer #ndcoslo
  • 29. { "_id": 1, "first_name": "Leslie", "last_name": "Yepp", "cell": "8125552344", "city": "Pawnee", "location": [ -86.536632, 39.170344 ], "hobbies": [ "scrapbooking", "eating waffles", "working” ], "jobHistory": [ { "title": "Deputy Director", "yearStarted": 2004 }, { "title": "City Councillor", "yearStarted": 2012 }, { "title": "Director, National Parks Service, Midwest Branch", "yearStarted": 2014 } ] } ID first_name last_name cell city latitude longitude 1 Leslie Yepp 8125552344 Pawnee 39.170344 -86.536632 2 Ron Swandaughte r 8125559347 Pawnee NULL NULL UsersUsers ID user_id hobby 10 1 scrapbooking 11 1 eating waffles 12 1 working Hobbies ID user_id job_title year_started 20 1 Deputy Directory 2004 21 1 City Councilor 2012 22 1 Director, National Parks Service, Midwest Branch 2014 JobHistory { "_id": 1, "first_name": "Ron", "last_name": "Swandaughter", "cell": "8125559347", "city": "Pawnee" } @Lauren_Schaefer #ndcoslo
  • 30. { "_id": 1, "first_name": "Leslie", "last_name": "Yepp", "cell": "8125552344", "city": "Pawnee", "location": [ -86.536632, 39.170344 ], "hobbies": [ "scrapbooking", "eating waffles", "working” ], "jobHistory": [ { "title": "Deputy Director", "yearStarted": 2004 }, { "title": "City Councillor", "yearStarted": 2012 }, { "title": "Director, National Parks Service, Midwest Branch", "yearStarted": 2014 } ] } ID first_name last_name cell city latitude longitude 1 Leslie Yepp 8125552344 Pawnee 39.170344 -86.536632 2 Ron Swandaughte r 8125559347 Pawnee NULL NULL UsersUsers ID user_id hobby 10 1 scrapbooking 11 1 eating waffles 12 1 working 13 2 woodworking 14 2 fishing Hobbies ID user_id job_title year_started 20 1 Deputy Directory 2004 21 1 City Councilor 2012 22 1 Director, National Parks Service, Midwest Branch 2014 23 2 Director 2002 24 2 CEO, Kinda Good Building Company 2014 JobHistory { "_id": 1, "first_name": "Ron", "last_name": "Swandaughter", "cell": "8125559347", "city": "Pawnee" } @Lauren_Schaefer #ndcoslo
  • 31. { "_id": 1, "first_name": "Leslie", "last_name": "Yepp", "cell": "8125552344", "city": "Pawnee", "location": [ -86.536632, 39.170344 ], "hobbies": [ "scrapbooking", "eating waffles", "working” ], "jobHistory": [ { "title": "Deputy Director", "yearStarted": 2004 }, { "title": "City Councillor", "yearStarted": 2012 }, { "title": "Director, National Parks Service, Midwest Branch", "yearStarted": 2014 } ] } ID first_name last_name cell city latitude longitude 1 Leslie Yepp 8125552344 Pawnee 39.170344 -86.536632 2 Ron Swandaughte r 8125559347 Pawnee NULL NULL UsersUsers ID user_id hobby 10 1 scrapbooking 11 1 eating waffles 12 1 working 13 2 woodworking 14 2 fishing Hobbies ID user_id job_title year_started 20 1 Deputy Directory 2004 21 1 City Councilor 2012 22 1 Director, National Parks Service, Midwest Branch 2014 23 2 Director 2002 24 2 CEO, Kinda Good Building Company 2014 JobHistory { "_id": 1, "first_name": "Ron", "last_name": "Swandaughter", "cell": "8125559347", "city": "Pawnee", "hobbies": [ "woodworking", "fishing" ], "jobHistory": [ { "title": "Director", "yearStarted": 2002 }, { "title": "CEO, Kinda Good Building Company", "yearStarted": 2014 } ] } @Lauren_Schaefer #ndcoslo
  • 32. { "_id": 1, "first_name": "Leslie", "last_name": "Yepp", "cell": "8125552344", "city": "Pawnee", "location": [ -86.536632, 39.170344 ], "hobbies": [ "scrapbooking", "eating waffles", "working” ], "jobHistory": [ { "title": "Deputy Director", "yearStarted": 2004 }, { "title": "City Councillor", "yearStarted": 2012 }, { "title": "Director, National Parks Service, Midwest Branch", "yearStarted": 2014 } ] } ID first_name last_name cell city latitude longitude 1 Leslie Yepp 8125552344 Pawnee 39.170344 -86.536632 2 Ron Swandaughte r 8125559347 Pawnee NULL NULL UsersUsers ID user_id hobby 10 1 scrapbooking 11 1 eating waffles 12 1 working 13 2 woodworking 14 2 fishing Hobbies ID user_id job_title year_started 20 1 Deputy Directory 2004 21 1 City Councilor 2012 22 1 Director, National Parks Service, Midwest Branch 2014 23 2 Director 2002 24 2 CEO, Kinda Good Building Company 2014 JobHistory { "_id": 1, "first_name": "Ron", "last_name": "Swandaughter", "cell": "8125559347", "city": "Pawnee", "hobbies": [ "woodworking", "fishing" ], "jobHistory": [ { "title": "Director", "yearStarted": 2002 }, { "title": "CEO, Kinda Good Building Company", "yearStarted": 2014 } ] } @Lauren_Schaefer #ndcoslo
  • 33. { "_id": 1, "first_name": "Leslie", "last_name": "Yepp", "cell": "8125552344", "city": "Pawnee", "location": [ -86.536632, 39.170344 ], "hobbies": [ "scrapbooking", "eating waffles", "working” ], "jobHistory": [ { "title": "Deputy Director", "yearStarted": 2004 }, { "title": "City Councillor", "yearStarted": 2012 }, { "title": "Director, National Parks Service, Midwest Branch", "yearStarted": 2014 } ] } ID first_name last_name cell city latitude longitude 1 Leslie Yepp 8125552344 Pawnee 39.170344 -86.536632 2 Ron Swandaughte r 8125559347 Pawnee NULL NULL 3 Lauren Burhug NULL Pawnee NULL NULL UsersUsers ID user_id hobby 10 1 scrapbooking 11 1 eating waffles 12 1 working 13 2 woodworking 14 2 fishing 15 3 soccer Hobbies ID user_id job_title year_started 20 1 Deputy Directory 2004 21 1 City Councilor 2012 22 1 Director, National Parks Service, Midwest Branch 2014 23 2 Director 2002 24 2 CEO, Kinda Good Building Company 2014 JobHistory { "_id": 1, "first_name": "Ron", "last_name": "Swandaughter", "cell": "8125559347", "city": "Pawnee", "hobbies": [ "woodworking", "fishing" ], "jobHistory": [ { "title": "Director", "yearStarted": 2002 }, { "title": "CEO, Kinda Good Building Company", "yearStarted": 2014 } ] } @Lauren_Schaefer #ndcoslo
  • 34. { "_id": 1, "first_name": "Leslie", "last_name": "Yepp", "cell": "8125552344", "city": "Pawnee", "location": [ -86.536632, 39.170344 ], "hobbies": [ "scrapbooking", "eating waffles", "working” ], "jobHistory": [ { "title": "Deputy Director", "yearStarted": 2004 }, { "title": "City Councillor", "yearStarted": 2012 }, { "title": "Director, National Parks Service, Midwest Branch", "yearStarted": 2014 } ] } ID first_name last_name cell city latitude longitude 1 Leslie Yepp 8125552344 Pawnee 39.170344 -86.536632 2 Ron Swandaughte r 8125559347 Pawnee NULL NULL 3 Lauren Burhug NULL Pawnee NULL NULL UsersUsers ID user_id hobby 10 1 scrapbooking 11 1 eating waffles 12 1 working 13 2 woodworking 14 2 fishing 15 3 soccer Hobbies ID user_id job_title year_started 20 1 Deputy Directory 2004 21 1 City Councilor 2012 22 1 Director, National Parks Service, Midwest Branch 2014 23 2 Director 2002 24 2 CEO, Kinda Good Building Company 2014 JobHistory { "_id": 1, "first_name": "Ron", "last_name": "Swandaughter", "cell": ”8125559347", "city": "Pawnee", "hobbies": [ ”woodworking", ”fishing" ], "jobHistory": [ { "title": "Director", "yearStarted": 2002 }, { "title": ”CEO, Kinda Good Building Company", "yearStarted": 2014 } ] } { "_id": 3, "first_name": "Lauren", "last_name": "Burhug", "city": "Pawnee", "hobbies": [ "soccer" ] } @Lauren_Schaefer #ndcoslo
  • 35. { "_id": 1, "first_name": "Leslie", "last_name": "Yepp", "cell": "8125552344", "city": "Pawnee", "location": [ -86.536632, 39.170344 ], "hobbies": [ "scrapbooking", "eating waffles", "working” ], "jobHistory": [ { "title": "Deputy Director", "yearStarted": 2004 }, { "title": "City Councillor", "yearStarted": 2012 }, { "title": "Director, National Parks Service, Midwest Branch", "yearStarted": 2014 } ] } ID first_name last_name cell city latitude longitude 1 Leslie Yepp 8125552344 Pawnee 39.170344 -86.536632 2 Ron Swandaughte r 8125559347 Pawnee NULL NULL 3 Lauren Burhug NULL Pawnee NULL NULL UsersUsers ID user_id hobby 10 1 scrapbooking 11 1 eating waffles 12 1 working 13 2 woodworking 14 2 fishing 15 3 soccer Hobbies ID user_id job_title year_started 20 1 Deputy Directory 2004 21 1 City Councilor 2012 22 1 Director, National Parks Service, Midwest Branch 2014 23 2 Director 2002 24 2 CEO, Kinda Good Building Company 2014 JobHistory { "_id": 1, "first_name": "Ron", "last_name": "Swandaughter", "cell": ”8125559347", "city": "Pawnee", "hobbies": [ ”woodworking", ”fishing" ], "jobHistory": [ { "title": "Director", "yearStarted": 2002 }, { "title": ”CEO, Kinda Good Building Company", "yearStarted": 2014 } ] } { "_id": 3, "first_name": "Lauren", "last_name": "Burhug", "city": "Pawnee", "hobbies": [ "soccer" ] } @Lauren_Schaefer #ndcoslo
  • 36. { "_id": 1, "first_name": "Leslie", "last_name": "Yepp", "cell": "8125552344", "city": "Pawnee", "location": [ -86.536632, 39.170344 ], "hobbies": [ "scrapbooking", "eating waffles", "working” ], "jobHistory": [ { "title": "Deputy Director", "yearStarted": 2004 }, { "title": "City Councillor", "yearStarted": 2012 }, { "title": "Director, National Parks Service, Midwest Branch", "yearStarted": 2014 } ] } ID first_name last_name cell city latitude longitude 1 Leslie Yepp 8125552344 Pawnee 39.170344 -86.536632 2 Ron Swandaughte r 8125559347 Pawnee NULL NULL 3 Lauren Burhug NULL Pawnee NULL NULL UsersUsers ID user_id hobby 10 1 scrapbooking 11 1 eating waffles 12 1 working 13 2 woodworking 14 2 fishing 15 3 soccer Hobbies ID user_id job_title year_started 20 1 Deputy Directory 2004 21 1 City Councilor 2012 22 1 Director, National Parks Service, Midwest Branch 2014 23 2 Director 2002 24 2 CEO, Kinda Good Building Company 2014 JobHistory { "_id": 1, "first_name": "Ron", "last_name": "Swandaughter", "cell": ”8125559347", "city": "Pawnee", "hobbies": [ ”woodworking", ”fishing" ], "jobHistory": [ { "title": "Director", "yearStarted": 2002 }, { "title": ”CEO, Kinda Good Building Company", "yearStarted": 2014 } ] } { "_id": 3, "first_name": "Lauren", "last_name": "Burhug", "city": "Pawnee", "hobbies": [ "soccer" ] } @Lauren_Schaefer #ndcoslo
  • 37. { "_id": 1, "first_name": "Leslie", "last_name": "Yepp", "cell": "8125552344", "city": "Pawnee", "location": [ -86.536632, 39.170344 ], "hobbies": [ "scrapbooking", "eating waffles", "working” ], "jobHistory": [ { "title": "Deputy Director", "yearStarted": 2004 }, { "title": "City Councillor", "yearStarted": 2012 }, { "title": "Director, National Parks Service, Midwest Branch", "yearStarted": 2014 } ] } ID first_name last_name cell city latitude longitude school 1 Leslie Yepp 8125552344 Pawnee 39.170344 -86.536632 NULL 2 Ron Swandaughte r 8125559347 Pawnee NULL NULL NULL 3 Lauren Burhug NULL Pawnee NULL NULL Pawnee Elementar y UsersUsers ID user_id hobby 10 1 scrapbooking 11 1 eating waffles 12 1 working 13 2 woodworking 14 2 fishing 15 3 soccer Hobbies ID user_id job_title year_started 20 1 Deputy Directory 2004 21 1 City Councilor 2012 22 1 Director, National Parks Service, Midwest Branch 2014 23 2 Director 2002 24 2 CEO, Kinda Good Building Company 2014 JobHistory { "_id": 1, "first_name": "Ron", "last_name": "Swandaughter", "cell": ”8125559347", "city": "Pawnee", "hobbies": [ ”woodworking", ”fishing" ], "jobHistory": [ { "title": "Director", "yearStarted": 2002 }, { "title": ”CEO, Kinda Good Building Company", "yearStarted": 2014 } ] } { "_id": 3, "first_name": "Lauren", "last_name": "Burhug", "city": "Pawnee", "hobbies": [ "soccer" ] } @Lauren_Schaefer #ndcoslo
  • 38. { "_id": 1, "first_name": "Leslie", "last_name": "Yepp", "cell": "8125552344", "city": "Pawnee", "location": [ -86.536632, 39.170344 ], "hobbies": [ "scrapbooking", "eating waffles", "working” ], "jobHistory": [ { "title": "Deputy Director", "yearStarted": 2004 }, { "title": "City Councillor", "yearStarted": 2012 }, { "title": "Director, National Parks Service, Midwest Branch", "yearStarted": 2014 } ] } ID first_name last_name cell city latitude longitude school 1 Leslie Yepp 8125552344 Pawnee 39.170344 -86.536632 NULL 2 Ron Swandaughte r 8125559347 Pawnee NULL NULL NULL 3 Lauren Burhug NULL Pawnee NULL NULL Pawnee Elementar y UsersUsers ID user_id hobby 10 1 scrapbooking 11 1 eating waffles 12 1 working 13 2 woodworking 14 2 fishing 15 3 soccer Hobbies ID user_id job_title year_started 20 1 Deputy Directory 2004 21 1 City Councilor 2012 22 1 Director, National Parks Service, Midwest Branch 2014 23 2 Director 2002 24 2 CEO, Kinda Good Building Company 2014 JobHistory { "_id": 1, "first_name": "Ron", "last_name": "Swandaughter", "cell": ”8125559347", "city": "Pawnee", "hobbies": [ ”woodworking", ”fishing" ], "jobHistory": [ { "title": "Director", "yearStarted": 2002 }, { "title": ”CEO, Kinda Good Building Company", "yearStarted": 2014 } ] } { "_id": 3, "first_name": "Lauren", "last_name": "Burhug", "city": "Pawnee", "hobbies": [ "soccer" ] } @Lauren_Schaefer #ndcoslo
  • 39. { "_id": 1, "first_name": "Leslie", "last_name": "Yepp", "cell": "8125552344", "city": "Pawnee", "location": [ -86.536632, 39.170344 ], "hobbies": [ "scrapbooking", "eating waffles", "working” ], "jobHistory": [ { "title": "Deputy Director", "yearStarted": 2004 }, { "title": "City Councillor", "yearStarted": 2012 }, { "title": "Director, National Parks Service, Midwest Branch", "yearStarted": 2014 } ] } ID first_name last_name cell city latitude longitude school 1 Leslie Yepp 8125552344 Pawnee 39.170344 -86.536632 NULL 2 Ron Swandaughte r 8125559347 Pawnee NULL NULL NULL 3 Lauren Burhug NULL Pawnee NULL NULL Pawnee Elementar y UsersUsers ID user_id hobby 10 1 scrapbooking 11 1 eating waffles 12 1 working 13 2 woodworking 14 2 fishing 15 3 soccer Hobbies ID user_id job_title year_started 20 1 Deputy Directory 2004 21 1 City Councilor 2012 22 1 Director, National Parks Service, Midwest Branch 2014 23 2 Director 2002 24 2 CEO, Kinda Good Building Company 2014 JobHistory { "_id": 1, "first_name": "Ron", "last_name": "Swandaughter", "cell": ”8125559347", "city": "Pawnee", "hobbies": [ ”woodworking", ”fishing" ], "jobHistory": [ { "title": "Director", "yearStarted": 2002 }, { "title": ”CEO, Kinda Good Building Company", "yearStarted": 2014 } ] } { "_id": 3, "first_name": "Lauren", "last_name": "Burhug", "city": "Pawnee", "hobbies": [ "soccer" ], "school": "Pawnee Elementary" } @Lauren_Schaefer #ndcoslo
  • 41. FlexibleSchema Don’t panic! Use schema validation. @Lauren_Schaefer #ndcoslo
  • 43. Row Document { ... a: “b” ... } ID a ... 1 b ... 2 ... ... 3 ... ... @Lauren_Schaefer #ndcoslo
  • 44. Row(s) Document { ... a: “b” ... } ID a ... 1 b ... 2 ... ... 3 ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... @Lauren_Schaefer #ndcoslo
  • 45. Column Field ID a ... 1 b ... 2 c ... 3 ... ... { ... a: “b” ... } { ... a: “c” ... } @Lauren_Schaefer #ndcoslo
  • 46. Table Collection { ... } ... ... ... ... ... ... ... ... ... ... ... ... { ... } { ... } @Lauren_Schaefer #ndcoslo
  • 47. Database Database { ... } { ... } { ... } { ... } { ... } { ... } { ... } ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... @Lauren_Schaefer #ndcoslo
  • 48. Index Index { ... } { ... } { ... } { ... } ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... @Lauren_Schaefer #ndcoslo
  • 49. View View { ... } ... ... ... ... ... ... ... ... ... ... ... ... { ... } { ... } @Lauren_Schaefer #ndcoslo
  • 50. Join Embedding { ... a: “b”, ... c: { d: “e” ... }, ... } ID a ... 1 b ... 2 ... ... 3 ... ... ... d ... 1 e ... ... ... ... @Lauren_Schaefer #ndcoslo
  • 51. Multi-Record ACID Transaction Multi-Document ACID Transaction { ... } { ... } { ... } { ... } { ... } { ... } { ... } ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... @Lauren_Schaefer #ndcoslo
  • 53. Themental journey from tables to documents 1. Map terms & concepts from tables to documents 2. Discover the 4 major advantages of documents 3. Change your mindset in 3 key ways @Lauren_Schaefer #ndcoslo
  • 56. Scalecheaper! As the size of your database grows, scale horizontally. @Lauren_Schaefer #ndcoslo
  • 57. Queryfaster! Stop doing expensive joins to get your data. Tabular Database ID a ... 1 b ... 2 ... ... 3 ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... Document Database { ... a: “b”, ... c: { d: “e” ... }, ... } @Lauren_Schaefer #ndcoslo
  • 58. Pivoteasier! Easily change the shape of your data as your app evolves. Document Database { first_name: “Lauren”, … } { first_name: “Lauren”, school: “Pawnee Elementary”, … } Relational Database ALTER TABLE `CityHall`.`Users` ADD COLUMN `school` VARCHAR(45) NULL AFTER `longitude`; @Lauren_Schaefer #ndcoslo
  • 59. Programfaster! Documents map to data structures in most popular languages. @Lauren_Schaefer #ndcoslo
  • 60. { "_id": 1, "first_name": "Leslie", "last_name": "Yepp", "cell": "8125552344", "city": "Pawnee", "location": [ -86.536632, 39.170344 ], "hobbies": [ "scrapbooking", "eating waffles", "working” ] } ID first_name last_name cell city latitude longitude school 1 Leslie Yepp 812555234 4 Pawnee 39.170344 -86.536632 NULL UsersUsers ID user_id hobby 10 1 scrapbooking 11 1 eating waffles 12 1 working Hobbies Programfaster! @Lauren_Schaefer #ndcoslo
  • 61. import mysql.connector # CONNECT TO THE DB mydb = mysql.connector.connect( host="localhost", user="root", passwd="rootroot", database="CityHall" ) mycursor = mydb.cursor(dictionary=True) # THE ID OF THE USER WHOSE PROFILE WE # WILL BE RETRIEVING AND UPDATING userId = 1 import pymongo from pymongo import MongoClient # CONNECT TO THE DB client = MongoClient() client = pymongo .MongoClient("mongodb+srv://root:rootro ot@mycluster.mongodb.net/test?retryWrit es=true&w=majority") db = client.CityHall # THE ID OF THE USER WHOSE PROFILE WE # WILL BE RETRIEVING AND UPDATING userId = 1 Programfaster!
  • 62. sql = "SELECT * FROM Users LEFT JOIN Hobbies ON Users.ID = Hobbies.user_id WHERE Users.id=%s" values = (userId,) my cursor.execute(sql, values) user = mycursor.fetchone() user = db['Users’] .find_one({"_id": userId}) Programfaster! hobbies = [] if (user["hobby"]): hobbies.append(user["hobby"]) del user["hobby"] del user["ID"] for result in mycursor: hobbies.append(result["hobby"]) user["hobbies"] = hobbies
  • 63. { 'city': 'Pawnee', 'first_name': 'Leslie', 'last_name': 'Yepp', 'school': None, 'cell': '8125552344', 'latitude': 39.1703, 'longitude': -86.5366,3 'hobbies’: [ 'scrapbooking’, 'eating waffles’, 'working’ ], 'user_id': 1 } { 'city': 'Pawnee', 'first_name’: 'Leslie', 'last_name': 'Yepp', 'cell': '8125552344', 'location': [-86.536632, 39.170344], 'hobbies’: [ 'scrapbooking’, 'eating waffles’, 'working’ ], '_id': 1 } Programfaster!
  • 64. user.update( { "city": "Washington, DC", "latitude": 38.897760, "longitude": -77.036809, "hobbies": [ "scrapbooking", "eating waffles", "signing bills"] } ) user.update( { "city": "Washington, DC", "location": [-77.036809, 38.897760], "hobbies": [ "scrapbooking", "eating waffles", "signing bills"] } ) Programfaster!
  • 65. sql = "UPDATE Users SET first_name=%s, last_name=%s, cell=%s, city=%s, latitude=%s, longitude=%s, school=%s WHERE (ID=%s)" values = (user["first_name"], user["last_name"], user["cell"], user["city"], user["latitude"], user["longitude"], user["school"], userId) mycursor.execute(sql, values) mydb.commit() result = db['Users’] .update_one( {"_id": userId}, {"$set": user}) Programfaster! sql = "DELETE FROM Hobbies WHERE user_id=%s" values = (userId,) mycursor.execute(sql, values) mydb.commit() if(len(user["hobbies"]) > 0): sql = "INSERT INTO Hobbies (user_id, hobby) VALUES (%s, %s)" values = [] for hobby in user["hobbies"]: values.append((userId, hobby)) mycursor.executemany(sql,values) mydb.commit()
  • 66. 27 lines of code 2 lines of code
  • 67. 4major advantagesof documents  Scale cheaper  Query faster  Pivot easier  Program faster @Lauren_Schaefer #ndcoslo
  • 68. Themental journey from tables to documents 1. Map terms & concepts from tables to documents 2. Discover the 4 major advantages of documents 3. Change your mindset in 3 key ways @Lauren_Schaefer #ndcoslo
  • 72. Embracedocumentdiversity The Polymorphic Pattern { "_id": 1, "first_name": "Leslie", "last_name": "Yepp", "cell": "8125552344", "city": "Pawnee", "location": [ -86.536632, 39.170344 ], "hobbies": [ "scrapbooking", "eating waffles", "working” ], "jobHistory": [ { "title": "Deputy Director", "yearStarted": 2004 }, { "title": "City Councillor", "yearStarted": 2012 }, { "title": "Director, National Parks Service, Midwest Branch", "yearStarted": 2014 } ] } { "_id": 1, "first_name": "Ron", "last_name": "Swandaughter", "cell": ”8125559347", "city": "Pawnee", "hobbies": [ ”woodworking", ”fishing" ], "jobHistory": [ { "title": "Director", "yearStarted": 2002 }, { "title": ”CEO, Kinda Good Building Company", "yearStarted": 2014 } ] } { "_id": 3, "first_name": "Lauren", "last_name": "Burhug", "city": "Pawnee", "hobbies": [ "soccer" ], "school": "Pawnee Elementary" } @Lauren_Schaefer #ndcoslo
  • 73. Embracedocumentdiversity The Outlier Pattern { "_id": 3, "first_name": "Lauren", "last_name": "Burhug", "city": "Pawnee", "hobbies": ["soccer"], "school": "Pawnee Elementary", "followers": [ "Brandon", "Wesley", "Ciara", ... ] } { "_id": 2, "first_name": "Ron", "last_name": "Swandaughter", "cell": "8125559347", "city": "Pawnee", "hobbies": [ "woodworking", "fishing"], "jobHistory": [ { "title": "Director", "yearStarted": 2002 }, ... ], "followers": [ "Leslie", "Donna", "Tom" ... ], "has_extras": true } { "_id": 2.1, "followers": [ "Jerry", "Ann", "Ben" ... ], "is_overflow": true } @Lauren_Schaefer #ndcoslo
  • 77. Datathatisaccessedtogethershouldbestoredtogether Don’t normalize your data for the sake of normalizing it. { a: “b”, c: { d: “e” ... }, f: [“g”, “h”, “i”], j: [ { k: “l” }, { m: “n” } ] } @Lauren_Schaefer #ndcoslo
  • 78. Treadcarefullywithtransactions Relying on transactions is a bad design smell. { ... } { ... } { ... } { ... } { ... } { ... } { ... } @Lauren_Schaefer #ndcoslo
  • 79. Changeyour mindsetin 3keyways  Embrace document diversity  Data that is accessed together should be stored together  Tread carefully with transactions @Lauren_Schaefer #ndcoslo
  • 81. Themental journey from tables to documents 1. Map terms & concepts from tables to documents @Lauren_Schaefer #ndcoslo
  • 82. Themental journey from tables to documents 1. Map terms & concepts from tables to documents 2. Discover the 4 major advantages of documents @Lauren_Schaefer #ndcoslo
  • 83. Themental journey from tables to documents 1. Map terms & concepts from tables to documents 2. Discover the 4 major advantages of documents 1. Scale cheaper @Lauren_Schaefer #ndcoslo
  • 84. Themental journey from tables to documents 1. Map terms & concepts from tables to documents 2. Discover the 4 major advantages of documents 1. Scale cheaper 2. Query faster @Lauren_Schaefer #ndcoslo
  • 85. Themental journey from tables to documents 1. Map terms & concepts from tables to documents 2. Discover the 4 major advantages of documents 1. Scale cheaper 2. Query faster 3. Pivot easier @Lauren_Schaefer #ndcoslo
  • 86. Themental journey from tables to documents 1. Map terms & concepts from tables to documents 2. Discover the 4 major advantages of documents 1. Scale cheaper 2. Query faster 3. Pivot easier 4. Program faster @Lauren_Schaefer #ndcoslo
  • 87. Themental journey from tables to documents 1. Map terms & concepts from tables to documents 2. Discover the 4 major advantages of documents 3. Change your mindset in 3 key ways @Lauren_Schaefer #ndcoslo
  • 88. Themental journey from tables to documents 1. Map terms & concepts from tables to documents 2. Discover the 4 major advantages of documents 3. Change your mindset in 3 key ways 1. Embrace document diversity @Lauren_Schaefer #ndcoslo
  • 89. Themental journey from tables to documents 1. Map terms & concepts from tables to documents 2. Discover the 4 major advantages of documents 3. Change your mindset in 3 key ways 1. Embrace document diversity 2. Data that is accessed together should be stored together { a: “b”, c: { d: “e” ... }, f: [“g”, “h”, “i”] } @Lauren_Schaefer #ndcoslo
  • 90. Themental journey from tables to documents 1. Map terms & concepts from tables to documents 2. Discover the 4 major advantages of documents 3. Change your mindset in 3 key ways 1. Embrace document diversity 2. Data that is accessed together should be stored together 3. Tread carefully with transactions @Lauren_Schaefer #ndcoslo
  • 91. Don’tbe RonSwanson (in this particular case) @Lauren_Schaefer #ndcoslo
  • 93. Additional Resources • SQL to MongoDB Blog (blog series) • Quick Start: MongoDB and Node.js (blog series) • Advanced Schema Design Patterns (webinar) • Building with Patterns: A Summary (blog series) • M320: Data Modeling (MongoDB University Course) • JSON Schema Validation – Locking down your model the smart way (blog) @Lauren_Schaefer #ndcoslo
  • 94. Changeyour mindset& getthefullvalueof document databases Give document databases a try using MongoDB Atlas Get the slides on my Twitter page: @Lauren_Schaefer @Lauren_Schaefer #ndcoslo