SlideShare a Scribd company logo
MONGODB ATLAS & MICROSOFTMONGODB ATLAS & MICROSOFT
AZUREAZURE
HANDS-ON EXERCISESHANDS-ON EXERCISES
Solutions Architect @ MongoDB |
Deck & Content |
Registration Link |
chris.grabosky@mongodb.com
l.gsky.us/#!mdbms 2018
l.gsky.us/#!mdbms 2018reg
Click Here For Printable Version
Speaker notes
On demand lab - Automated cloud service for MongoDB on Microsoft Azure - 14/11/2018 New York is currently scheduled
and ready for use on Wednesday, November 14, 2018.
The lab activation details are as follows:
Sign-Up Link (For All): http://bit.ly/2RBaRj6
Support Link (For Instructors / Proctors): http://bit.ly/mcw-support
It is recommended that you share the sign-up link with participants only during the specified lab time 09:00 AM (UTC-
05:00) Eastern Time (US & Canada) on Wednesday, November 14, 2018.
This information is shared with:
Chris Grabosky
Eugene Kang
Valmik Mehta
Mohan Das
Please share this information with other instructors / proctors, who were not tagged with this lab request.
TERMINOLOGY CHECKTERMINOLOGY CHECK
EXERCISE 1EXERCISE 1
MONGODB ATLAS & USERSMONGODB ATLAS & USERS
AT THE END OF THISAT THE END OF THIS EXERCISE 1EXERCISE 1
YOU SHOULD BE ABLE TO...YOU SHOULD BE ABLE TO...
Deploy a MongoDB Atlas Cluster (free-tier M0 or paid
M10+)
Understand basics of creating users and controls in
MongoDB Atlas
Know the difference between Atlas users and MongoDB
Users
DEPLOY M0 ON AZUREDEPLOY M0 ON AZURE
USERSUSERS
DB.CREATEUSER()DB.CREATEUSER()
EXERCISE 2EXERCISE 2
MONGODB COMPASS & CRUDMONGODB COMPASS & CRUD
AT THE END OF THISAT THE END OF THIS EXERCISE 2EXERCISE 2
YOU SHOULD BE ABLE TO...YOU SHOULD BE ABLE TO...
Launch Compass (tool to explore, visualize, optomize,
and modify MongoDB data) and connect to that cluster
Use Compass to create a database, create a collection,
and import a data set into that collection
Use Compass to create, read, update, and delete
(CRUD) documents in a collection
CONNECTING TO ATLAS WITHCONNECTING TO ATLAS WITH
COMPASSCOMPASS
CONNECTING TO ATLAS WITHCONNECTING TO ATLAS WITH
COMPASSCOMPASS
CREATING A DB & COLLECTIONCREATING A DB & COLLECTION
IMPORTING DATAIMPORTING DATA
DATASET:DATASET: l.gsky.us#!moviedatasetl.gsky.us#!moviedataset
CONNECTION STRINGSCONNECTION STRINGS
IF YOUR CLUSTER WORKS, USE IT, BUT...IF YOUR CLUSTER WORKS, USE IT, BUT...
Key Value
Server mdbazuretraining-v9iwf.azure.mongodb.net
SRV Record Yes on Switch
Authentication Username/Password
Username azureacct
Password azurepasswd
Auth DB admin
M001M001 CCRUD: LET'S CREATE...RUD: LET'S CREATE...
DB.MOVIES.INSERTONE({})DB.MOVIES.INSERTONE({})
0:00 / 1:20
Speaker notes
title: Ghostbusters
Year: 1984 Change Int32
Rated: PG
Runtime: 105 Change Int32
Type: movie
Genres: comedy, action Change Array
Director: Ivan Reitman
Writers: dan aykroyd, Harold ramis Change Array
DO NOT DO BELOW AS THAT IS DONE ON UPDATE:
imdb Change Object
imdb.id: tt0087332
imdb.rating: 7.8 Change Double
imdb.votes: 312,798 Change Int32
SCHEMA & DATA TYPESSCHEMA & DATA TYPES
M001 CM001 CRRUD: LET'S READ...UD: LET'S READ...
DB.MOVIES.FIND()DB.MOVIES.FIND()
M001 CRM001 CRUUD: LET'S UPDATE...D: LET'S UPDATE...
DB.MOVIES.UPDATEONE({},{$SET:{}})DB.MOVIES.UPDATEONE({},{$SET:{}})
Speaker notes
title: Ghostbusters
Year: 1984 Change Int32
Rated: PG
Runtime: 105 Change Int32
Type: movie
Genres: comedy, action Change Array
Director: Ivan Reitman
Writers: dan aykroyd, Harold ramis Change Array
ABOVE IS DONE, DO BELOW ON UPDATE:
imdb Change Object
imdb.id: tt0087332
imdb.rating: 7.8 Change Double
imdb.votes: 312,798 Change Int32
M001 CRUM001 CRUDD: LET'S DELETE...: LET'S DELETE...
DB.MOVIES.DELETEONE()DB.MOVIES.DELETEONE()
M001 CM001 CRRUD: FIND ME MOVIES...UD: FIND ME MOVIES...
Question Answer
From 1987
"Comedy" as one of their genres
"Comedy" as only genre
"Comedy" or "Drama"
"Comedy" and "Drama
IMDB Rating > 8.0 and PG Rating
Whole title of "Dr. Strangelove"
M001 CM001 CRRUD: FIND ME MOVIES...UD: FIND ME MOVIES...
Question Answer
From 1987
"Comedy" as one of their genres
"Comedy" as only genre
"Comedy" or "Drama"
"Comedy" and "Drama
IMDB Rating > 8.0 and PG Rating
Whole title of "Dr. Strangelove"
{year:1987}
M001 CM001 CRRUD: FIND ME MOVIES...UD: FIND ME MOVIES...
Question Answer
From 1987
"Comedy" as one of their genres
"Comedy" as only genre
"Comedy" or "Drama"
"Comedy" and "Drama
IMDB Rating > 8.0 and PG Rating
Whole title of "Dr. Strangelove"
{year:1987}
{genre:"Comedy"}
M001 CM001 CRRUD: FIND ME MOVIES...UD: FIND ME MOVIES...
Question Answer
From 1987
"Comedy" as one of their genres
"Comedy" as only genre
"Comedy" or "Drama"
"Comedy" and "Drama
IMDB Rating > 8.0 and PG Rating
Whole title of "Dr. Strangelove"
{year:1987}
{genre:"Comedy"}
{genres:["Comedy"]}
M001 CM001 CRRUD: FIND ME MOVIES...UD: FIND ME MOVIES...
Question Answer
From 1987
"Comedy" as one of their genres
"Comedy" as only genre
"Comedy" or "Drama"
"Comedy" and "Drama
IMDB Rating > 8.0 and PG Rating
Whole title of "Dr. Strangelove"
{year:1987}
{genre:"Comedy"}
{genres:["Comedy"]}
{genres:{$in:["Comedy", "Drama"]}}
M001 CM001 CRRUD: FIND ME MOVIES...UD: FIND ME MOVIES...
Question Answer
From 1987
"Comedy" as one of their genres
"Comedy" as only genre
"Comedy" or "Drama"
"Comedy" and "Drama
IMDB Rating > 8.0 and PG Rating
Whole title of "Dr. Strangelove"
{year:1987}
{genre:"Comedy"}
{genres:["Comedy"]}
{genres:{$in:["Comedy", "Drama"]}}
{ genres: { $all: ["Comedy", "Drama"] } }
M001 CM001 CRRUD: FIND ME MOVIES...UD: FIND ME MOVIES...
Question Answer
From 1987
"Comedy" as one of their genres
"Comedy" as only genre
"Comedy" or "Drama"
"Comedy" and "Drama
IMDB Rating > 8.0 and PG Rating
Whole title of "Dr. Strangelove"
{year:1987}
{genre:"Comedy"}
{genres:["Comedy"]}
{genres:{$in:["Comedy", "Drama"]}}
{ genres: { $all: ["Comedy", "Drama"] } }
{"imdb.rating" : {$gt: 8.0}, rated:"PG"}
M001 CM001 CRRUD: FIND ME MOVIES...UD: FIND ME MOVIES...
Question Answer
From 1987
"Comedy" as one of their genres
"Comedy" as only genre
"Comedy" or "Drama"
"Comedy" and "Drama
IMDB Rating > 8.0 and PG Rating
Whole title of "Dr. Strangelove"
{year:1987}
{genre:"Comedy"}
{genres:["Comedy"]}
{genres:{$in:["Comedy", "Drama"]}}
{ genres: { $all: ["Comedy", "Drama"] } }
{"imdb.rating" : {$gt: 8.0}, rated:"PG"}
{title: {$regex: '^Dr. Strangelove'}}
EXERCISE 3EXERCISE 3
INDEXES & EXPLAIN PLANINDEXES & EXPLAIN PLAN
AT THE END OF THISAT THE END OF THIS EXERCISE 3EXERCISE 3
YOU SHOULD BE ABLE TO...YOU SHOULD BE ABLE TO...
Identify how a query was run using the Explain Plan
Create an index on a collection
See how an index affects query plans
EXPLAIN PLANEXPLAIN PLAN
EXPLAIN PLANEXPLAIN PLAN
.FIND({"ADDRESS.ZIPCODE": {$GT: '5000'}, CUISINE:.FIND({"ADDRESS.ZIPCODE": {$GT: '5000'}, CUISINE:
'SUSHI'}).SORT({STARS:-1})'SUSHI'}).SORT({STARS:-1})
Not a good result...
ColScan and In-Memory Sort
We need indexes
WHAT INDEX TO USE?WHAT INDEX TO USE?
.FIND({"ADDRESS.ZIPCODE": {$GT: '5000'}, CUISINE:.FIND({"ADDRESS.ZIPCODE": {$GT: '5000'}, CUISINE:
'SUSHI'}).SORT({STARS:-1})'SUSHI'}).SORT({STARS:-1})
WHAT INDEX TO USE?WHAT INDEX TO USE?
.FIND({"ADDRESS.ZIPCODE": {$GT: '5000'}, CUISINE:.FIND({"ADDRESS.ZIPCODE": {$GT: '5000'}, CUISINE:
'SUSHI'}).SORT({STARS:-1})'SUSHI'}).SORT({STARS:-1})
Naive approach would be
db.createIndex({"address.zipcode":1, "cuisine":1, "stars":1})
WHAT INDEX TO USE?WHAT INDEX TO USE?
.FIND({"ADDRESS.ZIPCODE": {$GT: '5000'}, CUISINE:.FIND({"ADDRESS.ZIPCODE": {$GT: '5000'}, CUISINE:
'SUSHI'}).SORT({STARS:-1})'SUSHI'}).SORT({STARS:-1})
Naive approach would be
While better since it does an index scan, still doing an
memory sort since this is a range query, not equality
db.createIndex({"address.zipcode":1, "cuisine":1, "stars":1})
WHAT INDEX TO USE?WHAT INDEX TO USE?
.FIND({"ADDRESS.ZIPCODE": {$GT: '5000'}, CUISINE:.FIND({"ADDRESS.ZIPCODE": {$GT: '5000'}, CUISINE:
'SUSHI'}).SORT({STARS:-1})'SUSHI'}).SORT({STARS:-1})
Naive approach would be
While better since it does an index scan, still doing an
memory sort since this is a range query, not equality
Add the index above and compare
versus
db.createIndex({"address.zipcode":1, "cuisine":1, "stars":1})
.find({"address.zipcode": {$gt: '5000'}, cuisine: 'Sushi'}).sort
.find({"address.zipcode": '5000', cuisine: 'Sushi'}).sort({stars
ADDING INDEXADDING INDEX
ESR RULEESR RULE
Great rule of thumb
Remove your last index
Remember Equality, Sort, Range
ADDING INDEXADDING INDEX
ESR RULEESR RULE
Great rule of thumb
Remove your last index
Remember Equality, Sort, Range
db.createIndex({"cuisine":1, "stars":1, "address.zipcode":1})
EXERCISE 4EXERCISE 4
AGGREGATION FRAMEWORKAGGREGATION FRAMEWORK
AT THE END OF THISAT THE END OF THIS EXERCISE 4EXERCISE 4
YOU SHOULD BE ABLE TO...YOU SHOULD BE ABLE TO...
Have a basic understanding of what the aggregation
framework is
Write some basic queries using the aggregation
framework
AGGREGATION FRAMEWORKAGGREGATION FRAMEWORK
UNIVERSITY M121UNIVERSITY M121
AGGREGATION FRAMEWORKAGGREGATION FRAMEWORK
DB.COL.AGGREGATE([{STAGE1},{STAGE2},{STAGEN}])DB.COL.AGGREGATE([{STAGE1},{STAGE2},{STAGEN}])
AGG WORKSHOPAGG WORKSHOP
Question Answer
That Are Comedies
Have a rating
Just the title and how many years old
AGG WORKSHOPAGG WORKSHOP
Question Answer
That Are Comedies
Have a rating
Just the title and how many years old
$match {genres:"Comedy"}
AGG WORKSHOPAGG WORKSHOP
Question Answer
That Are Comedies
Have a rating
Just the title and how many years old
$match {genres:"Comedy"}
$match {rated:{$exists:true}}
AGG WORKSHOPAGG WORKSHOP
Question Answer
That Are Comedies
Have a rating
Just the title and how many years old
$match {genres:"Comedy"}
$match {rated:{$exists:true}}
$project {
_id:0,
title:1,
yearsOld: { $subtract: [2018,"$year"]}
}
1 DEGREE OF KEVIN BACON1 DEGREE OF KEVIN BACON
Stage 1
Stage 2
Stage 3
Stage 4
1 DEGREE OF KEVIN BACON1 DEGREE OF KEVIN BACON
Stage 1
Stage 2
Stage 3
Stage 4
$project {
title:1, actors:1,_id:0
}
1 DEGREE OF KEVIN BACON1 DEGREE OF KEVIN BACON
Stage 1
Stage 2
Stage 3
Stage 4
$project {
title:1, actors:1,_id:0
}
$graphLookup {
from: 'movies',
startWith: "$actors",
connectFromField: 'actors',
connectToField: 'actors',
as: 'foo',
maxDepth: 1,
depthField: 'degrees',
restrictSearchWithMatch: {actors:"Kevin Bacon"}
}
1 DEGREE OF KEVIN BACON1 DEGREE OF KEVIN BACON
Stage 1
Stage 2
Stage 3
Stage 4
$project {
title:1, actors:1,_id:0
}
$graphLookup {
from: 'movies',
startWith: "$actors",
connectFromField: 'actors',
connectToField: 'actors',
as: 'foo',
maxDepth: 1,
depthField: 'degrees',
restrictSearchWithMatch: {actors:"Kevin Bacon"}
}
$project {
title:1,actors:1,_id:0,"foo.title":1,"foo.actors":1,jumps:{$size:"$foo"}
}
1 DEGREE OF KEVIN BACON1 DEGREE OF KEVIN BACON
Stage 1
Stage 2
Stage 3
Stage 4
$project {
title:1, actors:1,_id:0
}
$graphLookup {
from: 'movies',
startWith: "$actors",
connectFromField: 'actors',
connectToField: 'actors',
as: 'foo',
maxDepth: 1,
depthField: 'degrees',
restrictSearchWithMatch: {actors:"Kevin Bacon"}
}
$project {
title:1,actors:1,_id:0,"foo.title":1,"foo.actors":1,jumps:{$size:"$foo"}
}
$match {
jumps:{$gt:0}
}
EXERCISE 5EXERCISE 5
BI CONNECTORBI CONNECTOR
AT THE END OF THISAT THE END OF THIS EXERCISE 5EXERCISE 5
YOU SHOULD BE ABLE TO...YOU SHOULD BE ABLE TO...
Enable BI Connector on a cluster
Connect to a MongoDB cluster using a SQL CLI or BI
tool like PowerBI
ENABLE BI CONNECTORENABLE BI CONNECTOR
HTTPS://DOCS.MONGODB.COM/BI-CONNECTOR/CURRENT/CONNECT/POWERBI/HTTPS://DOCS.MONGODB.COM/BI-CONNECTOR/CURRENT/CONNECT/POWERBI/
NOW WE TALK SQLNOW WE TALK SQL
NOW WE TALK SQLNOW WE TALK SQL
EWWEWW
CONFIGURING ODBCCONFIGURING ODBC
HTTPS://DOCS.MONGODB.COM/BI-CONNECTOR/CURRENT/CONNECT/POWERBI/HTTPS://DOCS.MONGODB.COM/BI-CONNECTOR/CURRENT/CONNECT/POWERBI/
CONFIGURING ODBCCONFIGURING ODBC
HTTPS://DOCS.MONGODB.COM/BI-CONNECTOR/CURRENT/CONNECT/POWERBI/HTTPS://DOCS.MONGODB.COM/BI-CONNECTOR/CURRENT/CONNECT/POWERBI/
LET'S MAKE SOME DASHBOARDSLET'S MAKE SOME DASHBOARDS
USE YOUR CLUSTER WITH MOVIES DBUSE YOUR CLUSTER WITH MOVIES DB
OR MY CLUSTER HAS LOTS OF CHOICES...OR MY CLUSTER HAS LOTS OF CHOICES...
EXERCISE 6EXERCISE 6
STITCH & INTEGRATIONSSTITCH & INTEGRATIONS
AT THE END OF THISAT THE END OF THIS EXERCISE 6EXERCISE 6
YOU SHOULD BE ABLE TO...YOU SHOULD BE ABLE TO...
Understand MongoDB Stitch serverless platform
capabilities
Create Stitch triggers on Change Streams, functions, etc
STITCH COMPONENTSSTITCH COMPONENTS
SERVERLESS SCENARIOSSERVERLESS SCENARIOS
App Atlas Tech Azure Tech Link
Bowling
Tracker
Query Anywhere
WebHooks
Trigger
Functions
Web App l.gsky.us/#!bowlsrc
"Instagram" Query Anywhere
WebHooks
Trigger
Functions
Web App
Azure Storage
Xamarin App
Cognitive
Vision
l.gsky.us/#!igsrc
"Tiny URL" WebHooks Web App l.gsky.us/#!linksrc
"INSTAGRAM" APP"INSTAGRAM" APP
UPLOADINGUPLOADING
"INSTAGRAM" APP"INSTAGRAM" APP
BROWSINGBROWSING
EXERCISE 7EXERCISE 7
BIG DATABIG DATA
AT THE END OF THISAT THE END OF THIS EXERCISE 7EXERCISE 7
YOU SHOULD BE ABLE TO...YOU SHOULD BE ABLE TO...
Register the MongoDB Spark Connector on Azure
Databricks
Write data to MongoDB
Load data from a MongoDB collection
Load data from an aggregation framework pipeline
Run Spark SQL
http://l.gsky.us#!ms sparkhttp://l.gsky.us#!ms spark
DOWNLOAD HTML CODEDOWNLOAD HTML CODE
http://l.gsky.us#!ms sparkhttp://l.gsky.us#!ms spark
THANK YOUTHANK YOU
CLOUD.MONGODB.COMCLOUD.MONGODB.COM
AZURE.MICROSOFT.COMAZURE.MICROSOFT.COM

More Related Content

Similar to Microsoft cloud workshop - automated cloud service for MongoDB on Microsoft Azure

Recommendations with Neo4j (FOSDEM 2015)
Recommendations with Neo4j (FOSDEM 2015)Recommendations with Neo4j (FOSDEM 2015)
Recommendations with Neo4j (FOSDEM 2015)Michal Bachman
 
Addmi 10.5-basic query-language
Addmi 10.5-basic query-languageAddmi 10.5-basic query-language
Addmi 10.5-basic query-languageodanyboy
 
Neo4J Coursework - Sammy Hegab 22-04-2016
Neo4J Coursework - Sammy Hegab  22-04-2016Neo4J Coursework - Sammy Hegab  22-04-2016
Neo4J Coursework - Sammy Hegab 22-04-2016Sammy Hegab
 
Powerful Analysis with the Aggregation Pipeline
Powerful Analysis with the Aggregation PipelinePowerful Analysis with the Aggregation Pipeline
Powerful Analysis with the Aggregation PipelineMongoDB
 
Session 1.5 supporting virtual integration of linked data with just-in-time...
Session 1.5   supporting virtual integration of linked data with just-in-time...Session 1.5   supporting virtual integration of linked data with just-in-time...
Session 1.5 supporting virtual integration of linked data with just-in-time...semanticsconference
 
"Powerful Analysis with the Aggregation Pipeline (Tutorial)"
"Powerful Analysis with the Aggregation Pipeline (Tutorial)""Powerful Analysis with the Aggregation Pipeline (Tutorial)"
"Powerful Analysis with the Aggregation Pipeline (Tutorial)"MongoDB
 
Graph Database Query Languages
Graph Database Query LanguagesGraph Database Query Languages
Graph Database Query LanguagesJay Coskey
 
Next Top Data Model by Ian Plosker
Next Top Data Model by Ian PloskerNext Top Data Model by Ian Plosker
Next Top Data Model by Ian PloskerSyncConf
 
MongoDB.local DC 2018: Tutorial - Data Analytics with MongoDB
MongoDB.local DC 2018: Tutorial - Data Analytics with MongoDBMongoDB.local DC 2018: Tutorial - Data Analytics with MongoDB
MongoDB.local DC 2018: Tutorial - Data Analytics with MongoDBMongoDB
 
MongoDB .local Paris 2020: Tout savoir sur le moteur de recherche Full Text S...
MongoDB .local Paris 2020: Tout savoir sur le moteur de recherche Full Text S...MongoDB .local Paris 2020: Tout savoir sur le moteur de recherche Full Text S...
MongoDB .local Paris 2020: Tout savoir sur le moteur de recherche Full Text S...MongoDB
 
What is Object Oriented CSS?
What is Object Oriented CSS?What is Object Oriented CSS?
What is Object Oriented CSS?Nicole Sullivan
 
MongoDB .local Munich 2019: Still Haven't Found What You Are Looking For? Use...
MongoDB .local Munich 2019: Still Haven't Found What You Are Looking For? Use...MongoDB .local Munich 2019: Still Haven't Found What You Are Looking For? Use...
MongoDB .local Munich 2019: Still Haven't Found What You Are Looking For? Use...MongoDB
 
Moving to hybrid relational/JSON data models
Moving to hybrid relational/JSON data modelsMoving to hybrid relational/JSON data models
Moving to hybrid relational/JSON data modelsMariaDB plc
 
Augmenting RDBMS with MongoDB for ecommerce
Augmenting RDBMS with MongoDB for ecommerceAugmenting RDBMS with MongoDB for ecommerce
Augmenting RDBMS with MongoDB for ecommerceSteven Francia
 
MongoDB .local London 2019: MongoDB Atlas Full-Text Search Deep Dive
MongoDB .local London 2019: MongoDB Atlas Full-Text Search Deep DiveMongoDB .local London 2019: MongoDB Atlas Full-Text Search Deep Dive
MongoDB .local London 2019: MongoDB Atlas Full-Text Search Deep DiveMongoDB
 
MongoDB.local Dallas 2019: Tips & Tricks for Avoiding Common Query Pitfalls
MongoDB.local Dallas 2019: Tips & Tricks for Avoiding Common Query PitfallsMongoDB.local Dallas 2019: Tips & Tricks for Avoiding Common Query Pitfalls
MongoDB.local Dallas 2019: Tips & Tricks for Avoiding Common Query PitfallsMongoDB
 
SQL Training in Ambala ! Batra Computer Centre
SQL Training in Ambala ! Batra Computer CentreSQL Training in Ambala ! Batra Computer Centre
SQL Training in Ambala ! Batra Computer Centrejatin batra
 
Test-driven Development (TDD)
Test-driven Development (TDD)Test-driven Development (TDD)
Test-driven Development (TDD)Bran van der Meer
 

Similar to Microsoft cloud workshop - automated cloud service for MongoDB on Microsoft Azure (20)

Recommendations with Neo4j (FOSDEM 2015)
Recommendations with Neo4j (FOSDEM 2015)Recommendations with Neo4j (FOSDEM 2015)
Recommendations with Neo4j (FOSDEM 2015)
 
Addmi 10.5-basic query-language
Addmi 10.5-basic query-languageAddmi 10.5-basic query-language
Addmi 10.5-basic query-language
 
Neo4J Coursework - Sammy Hegab 22-04-2016
Neo4J Coursework - Sammy Hegab  22-04-2016Neo4J Coursework - Sammy Hegab  22-04-2016
Neo4J Coursework - Sammy Hegab 22-04-2016
 
Powerful Analysis with the Aggregation Pipeline
Powerful Analysis with the Aggregation PipelinePowerful Analysis with the Aggregation Pipeline
Powerful Analysis with the Aggregation Pipeline
 
Session 1.5 supporting virtual integration of linked data with just-in-time...
Session 1.5   supporting virtual integration of linked data with just-in-time...Session 1.5   supporting virtual integration of linked data with just-in-time...
Session 1.5 supporting virtual integration of linked data with just-in-time...
 
"Powerful Analysis with the Aggregation Pipeline (Tutorial)"
"Powerful Analysis with the Aggregation Pipeline (Tutorial)""Powerful Analysis with the Aggregation Pipeline (Tutorial)"
"Powerful Analysis with the Aggregation Pipeline (Tutorial)"
 
Graph Database Query Languages
Graph Database Query LanguagesGraph Database Query Languages
Graph Database Query Languages
 
Next Top Data Model by Ian Plosker
Next Top Data Model by Ian PloskerNext Top Data Model by Ian Plosker
Next Top Data Model by Ian Plosker
 
MongoDB.local DC 2018: Tutorial - Data Analytics with MongoDB
MongoDB.local DC 2018: Tutorial - Data Analytics with MongoDBMongoDB.local DC 2018: Tutorial - Data Analytics with MongoDB
MongoDB.local DC 2018: Tutorial - Data Analytics with MongoDB
 
MongoDB .local Paris 2020: Tout savoir sur le moteur de recherche Full Text S...
MongoDB .local Paris 2020: Tout savoir sur le moteur de recherche Full Text S...MongoDB .local Paris 2020: Tout savoir sur le moteur de recherche Full Text S...
MongoDB .local Paris 2020: Tout savoir sur le moteur de recherche Full Text S...
 
NoSQL and CouchDB
NoSQL and CouchDBNoSQL and CouchDB
NoSQL and CouchDB
 
What is Object Oriented CSS?
What is Object Oriented CSS?What is Object Oriented CSS?
What is Object Oriented CSS?
 
MongoDB .local Munich 2019: Still Haven't Found What You Are Looking For? Use...
MongoDB .local Munich 2019: Still Haven't Found What You Are Looking For? Use...MongoDB .local Munich 2019: Still Haven't Found What You Are Looking For? Use...
MongoDB .local Munich 2019: Still Haven't Found What You Are Looking For? Use...
 
Moving to hybrid relational/JSON data models
Moving to hybrid relational/JSON data modelsMoving to hybrid relational/JSON data models
Moving to hybrid relational/JSON data models
 
Augmenting RDBMS with MongoDB for ecommerce
Augmenting RDBMS with MongoDB for ecommerceAugmenting RDBMS with MongoDB for ecommerce
Augmenting RDBMS with MongoDB for ecommerce
 
MongoDB .local London 2019: MongoDB Atlas Full-Text Search Deep Dive
MongoDB .local London 2019: MongoDB Atlas Full-Text Search Deep DiveMongoDB .local London 2019: MongoDB Atlas Full-Text Search Deep Dive
MongoDB .local London 2019: MongoDB Atlas Full-Text Search Deep Dive
 
Avoid Query Pitfalls
Avoid Query PitfallsAvoid Query Pitfalls
Avoid Query Pitfalls
 
MongoDB.local Dallas 2019: Tips & Tricks for Avoiding Common Query Pitfalls
MongoDB.local Dallas 2019: Tips & Tricks for Avoiding Common Query PitfallsMongoDB.local Dallas 2019: Tips & Tricks for Avoiding Common Query Pitfalls
MongoDB.local Dallas 2019: Tips & Tricks for Avoiding Common Query Pitfalls
 
SQL Training in Ambala ! Batra Computer Centre
SQL Training in Ambala ! Batra Computer CentreSQL Training in Ambala ! Batra Computer Centre
SQL Training in Ambala ! Batra Computer Centre
 
Test-driven Development (TDD)
Test-driven Development (TDD)Test-driven Development (TDD)
Test-driven Development (TDD)
 

Recently uploaded

Crafting the Perfect Measurement Sheet with PLM Integration
Crafting the Perfect Measurement Sheet with PLM IntegrationCrafting the Perfect Measurement Sheet with PLM Integration
Crafting the Perfect Measurement Sheet with PLM IntegrationWave PLM
 
Studiovity film pre-production and screenwriting software
Studiovity film pre-production and screenwriting softwareStudiovity film pre-production and screenwriting software
Studiovity film pre-production and screenwriting softwareinfo611746
 
Advanced Flow Concepts Every Developer Should Know
Advanced Flow Concepts Every Developer Should KnowAdvanced Flow Concepts Every Developer Should Know
Advanced Flow Concepts Every Developer Should KnowPeter Caitens
 
AI/ML Infra Meetup | Perspective on Deep Learning Framework
AI/ML Infra Meetup | Perspective on Deep Learning FrameworkAI/ML Infra Meetup | Perspective on Deep Learning Framework
AI/ML Infra Meetup | Perspective on Deep Learning FrameworkAlluxio, Inc.
 
Facemoji Keyboard released its 2023 State of Emoji report, outlining the most...
Facemoji Keyboard released its 2023 State of Emoji report, outlining the most...Facemoji Keyboard released its 2023 State of Emoji report, outlining the most...
Facemoji Keyboard released its 2023 State of Emoji report, outlining the most...rajkumar669520
 
AI/ML Infra Meetup | Improve Speed and GPU Utilization for Model Training & S...
AI/ML Infra Meetup | Improve Speed and GPU Utilization for Model Training & S...AI/ML Infra Meetup | Improve Speed and GPU Utilization for Model Training & S...
AI/ML Infra Meetup | Improve Speed and GPU Utilization for Model Training & S...Alluxio, Inc.
 
Breaking the Code : A Guide to WhatsApp Business API.pdf
Breaking the Code : A Guide to WhatsApp Business API.pdfBreaking the Code : A Guide to WhatsApp Business API.pdf
Breaking the Code : A Guide to WhatsApp Business API.pdfMeon Technology
 
AI/ML Infra Meetup | Reducing Prefill for LLM Serving in RAG
AI/ML Infra Meetup | Reducing Prefill for LLM Serving in RAGAI/ML Infra Meetup | Reducing Prefill for LLM Serving in RAG
AI/ML Infra Meetup | Reducing Prefill for LLM Serving in RAGAlluxio, Inc.
 
GraphAware - Transforming policing with graph-based intelligence analysis
GraphAware - Transforming policing with graph-based intelligence analysisGraphAware - Transforming policing with graph-based intelligence analysis
GraphAware - Transforming policing with graph-based intelligence analysisNeo4j
 
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...Shahin Sheidaei
 
Designing for Privacy in Amazon Web Services
Designing for Privacy in Amazon Web ServicesDesigning for Privacy in Amazon Web Services
Designing for Privacy in Amazon Web ServicesKrzysztofKkol1
 
Agnieszka Andrzejewska - BIM School Course in Kraków
Agnieszka Andrzejewska - BIM School Course in KrakówAgnieszka Andrzejewska - BIM School Course in Kraków
Agnieszka Andrzejewska - BIM School Course in Krakówbim.edu.pl
 
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital TransformationWSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital TransformationWSO2
 
Abortion ^Clinic ^%[+971588192166''] Abortion Pill Al Ain (?@?) Abortion Pill...
Abortion ^Clinic ^%[+971588192166''] Abortion Pill Al Ain (?@?) Abortion Pill...Abortion ^Clinic ^%[+971588192166''] Abortion Pill Al Ain (?@?) Abortion Pill...
Abortion ^Clinic ^%[+971588192166''] Abortion Pill Al Ain (?@?) Abortion Pill...Abortion Clinic
 
top nidhi software solution freedownload
top nidhi software solution freedownloadtop nidhi software solution freedownload
top nidhi software solution freedownloadvrstrong314
 
SOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar Research Team: Latest Activities of IntelBrokerSOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar Research Team: Latest Activities of IntelBrokerSOCRadar
 
Accelerate Enterprise Software Engineering with Platformless
Accelerate Enterprise Software Engineering with PlatformlessAccelerate Enterprise Software Engineering with Platformless
Accelerate Enterprise Software Engineering with PlatformlessWSO2
 
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...informapgpstrackings
 

Recently uploaded (20)

Crafting the Perfect Measurement Sheet with PLM Integration
Crafting the Perfect Measurement Sheet with PLM IntegrationCrafting the Perfect Measurement Sheet with PLM Integration
Crafting the Perfect Measurement Sheet with PLM Integration
 
Top Mobile App Development Companies 2024
Top Mobile App Development Companies 2024Top Mobile App Development Companies 2024
Top Mobile App Development Companies 2024
 
Studiovity film pre-production and screenwriting software
Studiovity film pre-production and screenwriting softwareStudiovity film pre-production and screenwriting software
Studiovity film pre-production and screenwriting software
 
Advanced Flow Concepts Every Developer Should Know
Advanced Flow Concepts Every Developer Should KnowAdvanced Flow Concepts Every Developer Should Know
Advanced Flow Concepts Every Developer Should Know
 
Corporate Management | Session 3 of 3 | Tendenci AMS
Corporate Management | Session 3 of 3 | Tendenci AMSCorporate Management | Session 3 of 3 | Tendenci AMS
Corporate Management | Session 3 of 3 | Tendenci AMS
 
AI/ML Infra Meetup | Perspective on Deep Learning Framework
AI/ML Infra Meetup | Perspective on Deep Learning FrameworkAI/ML Infra Meetup | Perspective on Deep Learning Framework
AI/ML Infra Meetup | Perspective on Deep Learning Framework
 
Facemoji Keyboard released its 2023 State of Emoji report, outlining the most...
Facemoji Keyboard released its 2023 State of Emoji report, outlining the most...Facemoji Keyboard released its 2023 State of Emoji report, outlining the most...
Facemoji Keyboard released its 2023 State of Emoji report, outlining the most...
 
AI/ML Infra Meetup | Improve Speed and GPU Utilization for Model Training & S...
AI/ML Infra Meetup | Improve Speed and GPU Utilization for Model Training & S...AI/ML Infra Meetup | Improve Speed and GPU Utilization for Model Training & S...
AI/ML Infra Meetup | Improve Speed and GPU Utilization for Model Training & S...
 
Breaking the Code : A Guide to WhatsApp Business API.pdf
Breaking the Code : A Guide to WhatsApp Business API.pdfBreaking the Code : A Guide to WhatsApp Business API.pdf
Breaking the Code : A Guide to WhatsApp Business API.pdf
 
AI/ML Infra Meetup | Reducing Prefill for LLM Serving in RAG
AI/ML Infra Meetup | Reducing Prefill for LLM Serving in RAGAI/ML Infra Meetup | Reducing Prefill for LLM Serving in RAG
AI/ML Infra Meetup | Reducing Prefill for LLM Serving in RAG
 
GraphAware - Transforming policing with graph-based intelligence analysis
GraphAware - Transforming policing with graph-based intelligence analysisGraphAware - Transforming policing with graph-based intelligence analysis
GraphAware - Transforming policing with graph-based intelligence analysis
 
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
 
Designing for Privacy in Amazon Web Services
Designing for Privacy in Amazon Web ServicesDesigning for Privacy in Amazon Web Services
Designing for Privacy in Amazon Web Services
 
Agnieszka Andrzejewska - BIM School Course in Kraków
Agnieszka Andrzejewska - BIM School Course in KrakówAgnieszka Andrzejewska - BIM School Course in Kraków
Agnieszka Andrzejewska - BIM School Course in Kraków
 
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital TransformationWSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
 
Abortion ^Clinic ^%[+971588192166''] Abortion Pill Al Ain (?@?) Abortion Pill...
Abortion ^Clinic ^%[+971588192166''] Abortion Pill Al Ain (?@?) Abortion Pill...Abortion ^Clinic ^%[+971588192166''] Abortion Pill Al Ain (?@?) Abortion Pill...
Abortion ^Clinic ^%[+971588192166''] Abortion Pill Al Ain (?@?) Abortion Pill...
 
top nidhi software solution freedownload
top nidhi software solution freedownloadtop nidhi software solution freedownload
top nidhi software solution freedownload
 
SOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar Research Team: Latest Activities of IntelBrokerSOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar Research Team: Latest Activities of IntelBroker
 
Accelerate Enterprise Software Engineering with Platformless
Accelerate Enterprise Software Engineering with PlatformlessAccelerate Enterprise Software Engineering with Platformless
Accelerate Enterprise Software Engineering with Platformless
 
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
 

Microsoft cloud workshop - automated cloud service for MongoDB on Microsoft Azure

  • 1. MONGODB ATLAS & MICROSOFTMONGODB ATLAS & MICROSOFT AZUREAZURE HANDS-ON EXERCISESHANDS-ON EXERCISES Solutions Architect @ MongoDB | Deck & Content | Registration Link | chris.grabosky@mongodb.com l.gsky.us/#!mdbms 2018 l.gsky.us/#!mdbms 2018reg Click Here For Printable Version Speaker notes On demand lab - Automated cloud service for MongoDB on Microsoft Azure - 14/11/2018 New York is currently scheduled and ready for use on Wednesday, November 14, 2018. The lab activation details are as follows: Sign-Up Link (For All): http://bit.ly/2RBaRj6 Support Link (For Instructors / Proctors): http://bit.ly/mcw-support It is recommended that you share the sign-up link with participants only during the specified lab time 09:00 AM (UTC- 05:00) Eastern Time (US & Canada) on Wednesday, November 14, 2018. This information is shared with: Chris Grabosky Eugene Kang Valmik Mehta Mohan Das Please share this information with other instructors / proctors, who were not tagged with this lab request.
  • 3. EXERCISE 1EXERCISE 1 MONGODB ATLAS & USERSMONGODB ATLAS & USERS
  • 4. AT THE END OF THISAT THE END OF THIS EXERCISE 1EXERCISE 1 YOU SHOULD BE ABLE TO...YOU SHOULD BE ABLE TO... Deploy a MongoDB Atlas Cluster (free-tier M0 or paid M10+) Understand basics of creating users and controls in MongoDB Atlas Know the difference between Atlas users and MongoDB Users
  • 5. DEPLOY M0 ON AZUREDEPLOY M0 ON AZURE
  • 7. EXERCISE 2EXERCISE 2 MONGODB COMPASS & CRUDMONGODB COMPASS & CRUD
  • 8. AT THE END OF THISAT THE END OF THIS EXERCISE 2EXERCISE 2 YOU SHOULD BE ABLE TO...YOU SHOULD BE ABLE TO... Launch Compass (tool to explore, visualize, optomize, and modify MongoDB data) and connect to that cluster Use Compass to create a database, create a collection, and import a data set into that collection Use Compass to create, read, update, and delete (CRUD) documents in a collection
  • 9. CONNECTING TO ATLAS WITHCONNECTING TO ATLAS WITH COMPASSCOMPASS
  • 10. CONNECTING TO ATLAS WITHCONNECTING TO ATLAS WITH COMPASSCOMPASS
  • 11. CREATING A DB & COLLECTIONCREATING A DB & COLLECTION
  • 12. IMPORTING DATAIMPORTING DATA DATASET:DATASET: l.gsky.us#!moviedatasetl.gsky.us#!moviedataset
  • 13. CONNECTION STRINGSCONNECTION STRINGS IF YOUR CLUSTER WORKS, USE IT, BUT...IF YOUR CLUSTER WORKS, USE IT, BUT... Key Value Server mdbazuretraining-v9iwf.azure.mongodb.net SRV Record Yes on Switch Authentication Username/Password Username azureacct Password azurepasswd Auth DB admin
  • 14. M001M001 CCRUD: LET'S CREATE...RUD: LET'S CREATE... DB.MOVIES.INSERTONE({})DB.MOVIES.INSERTONE({})
  • 15. 0:00 / 1:20 Speaker notes title: Ghostbusters Year: 1984 Change Int32 Rated: PG Runtime: 105 Change Int32 Type: movie Genres: comedy, action Change Array Director: Ivan Reitman Writers: dan aykroyd, Harold ramis Change Array DO NOT DO BELOW AS THAT IS DONE ON UPDATE: imdb Change Object imdb.id: tt0087332 imdb.rating: 7.8 Change Double imdb.votes: 312,798 Change Int32
  • 16. SCHEMA & DATA TYPESSCHEMA & DATA TYPES
  • 17.
  • 18. M001 CM001 CRRUD: LET'S READ...UD: LET'S READ... DB.MOVIES.FIND()DB.MOVIES.FIND()
  • 19. M001 CRM001 CRUUD: LET'S UPDATE...D: LET'S UPDATE... DB.MOVIES.UPDATEONE({},{$SET:{}})DB.MOVIES.UPDATEONE({},{$SET:{}}) Speaker notes title: Ghostbusters Year: 1984 Change Int32 Rated: PG Runtime: 105 Change Int32 Type: movie Genres: comedy, action Change Array Director: Ivan Reitman Writers: dan aykroyd, Harold ramis Change Array ABOVE IS DONE, DO BELOW ON UPDATE: imdb Change Object imdb.id: tt0087332 imdb.rating: 7.8 Change Double imdb.votes: 312,798 Change Int32
  • 20. M001 CRUM001 CRUDD: LET'S DELETE...: LET'S DELETE... DB.MOVIES.DELETEONE()DB.MOVIES.DELETEONE()
  • 21. M001 CM001 CRRUD: FIND ME MOVIES...UD: FIND ME MOVIES... Question Answer From 1987 "Comedy" as one of their genres "Comedy" as only genre "Comedy" or "Drama" "Comedy" and "Drama IMDB Rating > 8.0 and PG Rating Whole title of "Dr. Strangelove"
  • 22. M001 CM001 CRRUD: FIND ME MOVIES...UD: FIND ME MOVIES... Question Answer From 1987 "Comedy" as one of their genres "Comedy" as only genre "Comedy" or "Drama" "Comedy" and "Drama IMDB Rating > 8.0 and PG Rating Whole title of "Dr. Strangelove" {year:1987}
  • 23. M001 CM001 CRRUD: FIND ME MOVIES...UD: FIND ME MOVIES... Question Answer From 1987 "Comedy" as one of their genres "Comedy" as only genre "Comedy" or "Drama" "Comedy" and "Drama IMDB Rating > 8.0 and PG Rating Whole title of "Dr. Strangelove" {year:1987} {genre:"Comedy"}
  • 24. M001 CM001 CRRUD: FIND ME MOVIES...UD: FIND ME MOVIES... Question Answer From 1987 "Comedy" as one of their genres "Comedy" as only genre "Comedy" or "Drama" "Comedy" and "Drama IMDB Rating > 8.0 and PG Rating Whole title of "Dr. Strangelove" {year:1987} {genre:"Comedy"} {genres:["Comedy"]}
  • 25. M001 CM001 CRRUD: FIND ME MOVIES...UD: FIND ME MOVIES... Question Answer From 1987 "Comedy" as one of their genres "Comedy" as only genre "Comedy" or "Drama" "Comedy" and "Drama IMDB Rating > 8.0 and PG Rating Whole title of "Dr. Strangelove" {year:1987} {genre:"Comedy"} {genres:["Comedy"]} {genres:{$in:["Comedy", "Drama"]}}
  • 26. M001 CM001 CRRUD: FIND ME MOVIES...UD: FIND ME MOVIES... Question Answer From 1987 "Comedy" as one of their genres "Comedy" as only genre "Comedy" or "Drama" "Comedy" and "Drama IMDB Rating > 8.0 and PG Rating Whole title of "Dr. Strangelove" {year:1987} {genre:"Comedy"} {genres:["Comedy"]} {genres:{$in:["Comedy", "Drama"]}} { genres: { $all: ["Comedy", "Drama"] } }
  • 27. M001 CM001 CRRUD: FIND ME MOVIES...UD: FIND ME MOVIES... Question Answer From 1987 "Comedy" as one of their genres "Comedy" as only genre "Comedy" or "Drama" "Comedy" and "Drama IMDB Rating > 8.0 and PG Rating Whole title of "Dr. Strangelove" {year:1987} {genre:"Comedy"} {genres:["Comedy"]} {genres:{$in:["Comedy", "Drama"]}} { genres: { $all: ["Comedy", "Drama"] } } {"imdb.rating" : {$gt: 8.0}, rated:"PG"}
  • 28. M001 CM001 CRRUD: FIND ME MOVIES...UD: FIND ME MOVIES... Question Answer From 1987 "Comedy" as one of their genres "Comedy" as only genre "Comedy" or "Drama" "Comedy" and "Drama IMDB Rating > 8.0 and PG Rating Whole title of "Dr. Strangelove" {year:1987} {genre:"Comedy"} {genres:["Comedy"]} {genres:{$in:["Comedy", "Drama"]}} { genres: { $all: ["Comedy", "Drama"] } } {"imdb.rating" : {$gt: 8.0}, rated:"PG"} {title: {$regex: '^Dr. Strangelove'}}
  • 29. EXERCISE 3EXERCISE 3 INDEXES & EXPLAIN PLANINDEXES & EXPLAIN PLAN
  • 30. AT THE END OF THISAT THE END OF THIS EXERCISE 3EXERCISE 3 YOU SHOULD BE ABLE TO...YOU SHOULD BE ABLE TO... Identify how a query was run using the Explain Plan Create an index on a collection See how an index affects query plans
  • 32.
  • 33. EXPLAIN PLANEXPLAIN PLAN .FIND({"ADDRESS.ZIPCODE": {$GT: '5000'}, CUISINE:.FIND({"ADDRESS.ZIPCODE": {$GT: '5000'}, CUISINE: 'SUSHI'}).SORT({STARS:-1})'SUSHI'}).SORT({STARS:-1}) Not a good result... ColScan and In-Memory Sort We need indexes
  • 34. WHAT INDEX TO USE?WHAT INDEX TO USE? .FIND({"ADDRESS.ZIPCODE": {$GT: '5000'}, CUISINE:.FIND({"ADDRESS.ZIPCODE": {$GT: '5000'}, CUISINE: 'SUSHI'}).SORT({STARS:-1})'SUSHI'}).SORT({STARS:-1})
  • 35. WHAT INDEX TO USE?WHAT INDEX TO USE? .FIND({"ADDRESS.ZIPCODE": {$GT: '5000'}, CUISINE:.FIND({"ADDRESS.ZIPCODE": {$GT: '5000'}, CUISINE: 'SUSHI'}).SORT({STARS:-1})'SUSHI'}).SORT({STARS:-1}) Naive approach would be db.createIndex({"address.zipcode":1, "cuisine":1, "stars":1})
  • 36. WHAT INDEX TO USE?WHAT INDEX TO USE? .FIND({"ADDRESS.ZIPCODE": {$GT: '5000'}, CUISINE:.FIND({"ADDRESS.ZIPCODE": {$GT: '5000'}, CUISINE: 'SUSHI'}).SORT({STARS:-1})'SUSHI'}).SORT({STARS:-1}) Naive approach would be While better since it does an index scan, still doing an memory sort since this is a range query, not equality db.createIndex({"address.zipcode":1, "cuisine":1, "stars":1})
  • 37. WHAT INDEX TO USE?WHAT INDEX TO USE? .FIND({"ADDRESS.ZIPCODE": {$GT: '5000'}, CUISINE:.FIND({"ADDRESS.ZIPCODE": {$GT: '5000'}, CUISINE: 'SUSHI'}).SORT({STARS:-1})'SUSHI'}).SORT({STARS:-1}) Naive approach would be While better since it does an index scan, still doing an memory sort since this is a range query, not equality Add the index above and compare versus db.createIndex({"address.zipcode":1, "cuisine":1, "stars":1}) .find({"address.zipcode": {$gt: '5000'}, cuisine: 'Sushi'}).sort .find({"address.zipcode": '5000', cuisine: 'Sushi'}).sort({stars
  • 38. ADDING INDEXADDING INDEX ESR RULEESR RULE Great rule of thumb Remove your last index Remember Equality, Sort, Range
  • 39. ADDING INDEXADDING INDEX ESR RULEESR RULE Great rule of thumb Remove your last index Remember Equality, Sort, Range db.createIndex({"cuisine":1, "stars":1, "address.zipcode":1})
  • 40. EXERCISE 4EXERCISE 4 AGGREGATION FRAMEWORKAGGREGATION FRAMEWORK
  • 41. AT THE END OF THISAT THE END OF THIS EXERCISE 4EXERCISE 4 YOU SHOULD BE ABLE TO...YOU SHOULD BE ABLE TO... Have a basic understanding of what the aggregation framework is Write some basic queries using the aggregation framework
  • 43.
  • 45. AGG WORKSHOPAGG WORKSHOP Question Answer That Are Comedies Have a rating Just the title and how many years old
  • 46. AGG WORKSHOPAGG WORKSHOP Question Answer That Are Comedies Have a rating Just the title and how many years old $match {genres:"Comedy"}
  • 47. AGG WORKSHOPAGG WORKSHOP Question Answer That Are Comedies Have a rating Just the title and how many years old $match {genres:"Comedy"} $match {rated:{$exists:true}}
  • 48. AGG WORKSHOPAGG WORKSHOP Question Answer That Are Comedies Have a rating Just the title and how many years old $match {genres:"Comedy"} $match {rated:{$exists:true}} $project { _id:0, title:1, yearsOld: { $subtract: [2018,"$year"]} }
  • 49. 1 DEGREE OF KEVIN BACON1 DEGREE OF KEVIN BACON Stage 1 Stage 2 Stage 3 Stage 4
  • 50. 1 DEGREE OF KEVIN BACON1 DEGREE OF KEVIN BACON Stage 1 Stage 2 Stage 3 Stage 4 $project { title:1, actors:1,_id:0 }
  • 51. 1 DEGREE OF KEVIN BACON1 DEGREE OF KEVIN BACON Stage 1 Stage 2 Stage 3 Stage 4 $project { title:1, actors:1,_id:0 } $graphLookup { from: 'movies', startWith: "$actors", connectFromField: 'actors', connectToField: 'actors', as: 'foo', maxDepth: 1, depthField: 'degrees', restrictSearchWithMatch: {actors:"Kevin Bacon"} }
  • 52. 1 DEGREE OF KEVIN BACON1 DEGREE OF KEVIN BACON Stage 1 Stage 2 Stage 3 Stage 4 $project { title:1, actors:1,_id:0 } $graphLookup { from: 'movies', startWith: "$actors", connectFromField: 'actors', connectToField: 'actors', as: 'foo', maxDepth: 1, depthField: 'degrees', restrictSearchWithMatch: {actors:"Kevin Bacon"} } $project { title:1,actors:1,_id:0,"foo.title":1,"foo.actors":1,jumps:{$size:"$foo"} }
  • 53. 1 DEGREE OF KEVIN BACON1 DEGREE OF KEVIN BACON Stage 1 Stage 2 Stage 3 Stage 4 $project { title:1, actors:1,_id:0 } $graphLookup { from: 'movies', startWith: "$actors", connectFromField: 'actors', connectToField: 'actors', as: 'foo', maxDepth: 1, depthField: 'degrees', restrictSearchWithMatch: {actors:"Kevin Bacon"} } $project { title:1,actors:1,_id:0,"foo.title":1,"foo.actors":1,jumps:{$size:"$foo"} } $match { jumps:{$gt:0} }
  • 54. EXERCISE 5EXERCISE 5 BI CONNECTORBI CONNECTOR
  • 55. AT THE END OF THISAT THE END OF THIS EXERCISE 5EXERCISE 5 YOU SHOULD BE ABLE TO...YOU SHOULD BE ABLE TO... Enable BI Connector on a cluster Connect to a MongoDB cluster using a SQL CLI or BI tool like PowerBI
  • 56. ENABLE BI CONNECTORENABLE BI CONNECTOR HTTPS://DOCS.MONGODB.COM/BI-CONNECTOR/CURRENT/CONNECT/POWERBI/HTTPS://DOCS.MONGODB.COM/BI-CONNECTOR/CURRENT/CONNECT/POWERBI/
  • 57. NOW WE TALK SQLNOW WE TALK SQL
  • 58.
  • 59. NOW WE TALK SQLNOW WE TALK SQL EWWEWW
  • 60.
  • 62.
  • 64. LET'S MAKE SOME DASHBOARDSLET'S MAKE SOME DASHBOARDS USE YOUR CLUSTER WITH MOVIES DBUSE YOUR CLUSTER WITH MOVIES DB OR MY CLUSTER HAS LOTS OF CHOICES...OR MY CLUSTER HAS LOTS OF CHOICES...
  • 65. EXERCISE 6EXERCISE 6 STITCH & INTEGRATIONSSTITCH & INTEGRATIONS
  • 66. AT THE END OF THISAT THE END OF THIS EXERCISE 6EXERCISE 6 YOU SHOULD BE ABLE TO...YOU SHOULD BE ABLE TO... Understand MongoDB Stitch serverless platform capabilities Create Stitch triggers on Change Streams, functions, etc
  • 68. SERVERLESS SCENARIOSSERVERLESS SCENARIOS App Atlas Tech Azure Tech Link Bowling Tracker Query Anywhere WebHooks Trigger Functions Web App l.gsky.us/#!bowlsrc "Instagram" Query Anywhere WebHooks Trigger Functions Web App Azure Storage Xamarin App Cognitive Vision l.gsky.us/#!igsrc "Tiny URL" WebHooks Web App l.gsky.us/#!linksrc
  • 70.
  • 72. EXERCISE 7EXERCISE 7 BIG DATABIG DATA
  • 73. AT THE END OF THISAT THE END OF THIS EXERCISE 7EXERCISE 7 YOU SHOULD BE ABLE TO...YOU SHOULD BE ABLE TO... Register the MongoDB Spark Connector on Azure Databricks Write data to MongoDB Load data from a MongoDB collection Load data from an aggregation framework pipeline Run Spark SQL http://l.gsky.us#!ms sparkhttp://l.gsky.us#!ms spark
  • 74. DOWNLOAD HTML CODEDOWNLOAD HTML CODE http://l.gsky.us#!ms sparkhttp://l.gsky.us#!ms spark