SlideShare a Scribd company logo
1 of 46
#MDBlocal
Today’s Pre-Reqs
For today’s workshop you’ll need the following:
● Computer
○ Preferably a Mac
○ Or a working knowledge of Windows + NodeJS
● MongoDB Atlas Cluster running 3.4+ (can be free tier)
● NodeJS 6.0+/npm
● Important:
○ Files: https://github.com/mongodb/stitch-examples
■ Under ‘Dashboard’
○ Documentation: https://docs.mongodb.com/stitch/getting-started/dashboard/
#MDBlocal
Drew DiPalma
Product Manager – Stitch
#MDBlocal
Agenda for this Workshop:
Intro to Stitch
+ Atlas
What we’ll
work on today
Creating a
simple API
Building a D3
Dashboard
Adding
Authentication
Next steps
with Stitch
01 02 03 04 05 06
#MDBlocal
Today’s Pre-Reqs
For today’s workshop you’ll need the following:
● Computer
○ Preferably a Mac
○ Or a working knowledge of Windows + NodeJS
● NodeJS/npm
● Important: Get the files/README (https://goo.gl/CU1JV1)
#MDBlocal
Intro to Stitch
#MDBE17
MongoDB Query Language + Native DriversIntegrated Rules
Pipelines 3rd Party Services
Native SDKs (iOS, Android, JS)
Rest-like API
https://docs.mongodb.com/stitch/getting-started/dashboard/
#MDBE17
Stitch let’s you control the flow of data:
Integrated services and
Pipelines for complex,
multi-stage workflows
Native SDKs for Android,
JS, and iOS clients
Direct Database Access
https://docs.mongodb.com/stitch/getting-started/dashboard/
#MDBlocal
Get Started with
Atlas
#MDBlocal
https://mongodb.com/atlas – Sign up, free.
https://docs.mongodb.com/stitch/getting-started/dashboard/
#MDBlocal
Launch the cluster (Remember your password!)
#MDBlocal
Whitelist your IP
https://docs.mongodb.com/stitch/getting-started/dashboard/
#MDBlocal
What we’ll work on
today
#MDBlocal
Our Data
*Point-of-sale data from a Pizza shop
(But Similar to Point-of-Sale, Log, Telemetry, etc. data you
would see elsewhere)
* Our Goal
https://docs.mongodb.com/stitch/getting-started/dashboard/
#MDBlocal
1. Data enters through Stitch, flows into Atlas
2. Stitch can augment data loading:
a) Grabbing extra data from an external API
b) Taking an action on load (e-mail receipt)
3. Can expose data through API, Web/mobile
app, or Atlas
(Remember: You can also use Stitch with
an existing database too)
Behind the scenes, Stitch connects Everything
Dash +
Auth
MongoDB
Stitch
MongoDB
Atlas
Sales
Data
API Access
https://docs.mongodb.com/stitch/getting-started/dashboard/
#MDBlocal
Getting Started
with Stitch
#MDBlocal
Click ‘Stitch Apps’ in Atlas
https://docs.mongodb.com/stitch/getting-started/dashboard/
#MDBlocal
Create a new App
#MDBlocal
Welcome to Stitch!
#MDBlocal
Let’s start by adding Auth
#MDBlocal
Next, let’s add the Receipts Collection
#MDBlocal
Finally, copy your App ID
#MDBlocal
In Stitch, you opt-in each namespace in your
database separately for access.
1. Go to SalesReporting.Receipts
namespace
2. Delete the default Filter under ‘Filters’
3. Delete the default rules (including Owner
Id field rules)
4. Set the Top-level Document Read/Write
rules to {}
5. This enables Public read/write to this
namespace only
Next, set-up simple Access Rules:
https://docs.mongodb.com/stitch/getting-started/dashboard/
#MDBlocal
Now let’s load data:
1. Open the data_generator.js file
2. Add your App ID (line 10)
3. Run data_generator.js
4. Watch data load into Stitch!
https://docs.mongodb.com/stitch/getting-started/dashboard/
#MDBlocal
Creating a Simple
Public API
#MDBlocal
In Stitch, you can add a number of predefined services
to your app.
Services have predefined actions to ease integration.
We’ll use the HTTP Service to create an API to our data
1. Click ‘Add Service’
2. Click ‘HTTP’ and name your service ‘SalesAPI’
Create a HTTP Service:
#MDBlocal
Create a Webhook:
For the HTTP service, you can create an
incoming webhook that will execute a
function in response to a request.
1. Within AggregateToppings, click ‘New
Webhook’
2. Name your new webhook ‘GetSales’
3. Switch ‘Respond with Result’ ON
4. Click ‘Require Secret as Query Param’
5. Set Secret to ‘SECRET’
#MDBlocal
Get the distribution of toppings for the last 100
pizzas.
1. Function that uses aggregation to:
a) Sort the orders in descending time order
b) Limit the number of orders to 100
c) Group the orders by topping
Add a Function to the Webhook:
https://docs.mongodb.com/stitch/getting-started/dashboard/
#MDBlocal
Now you can access your data via HTTP!
curl -X POST -H [WEBHOOK_URL]?secret=[SECRET] | python -m json.tool
#MDBlocal
Building a
Dashboard
#MDBlocal
Add a Function:
SalesTimeline – Get the sales for a given time
interval
1. Find all the sales in a certain timeframe
a) Projects fields down to just timestamp/total
b) Sorts by timestamp
c) Limits to 100 documents
2. Make sure function is named ‘SalesTimeline’
3. Set ‘Can Evaluate’ to {}
#MDBlocal
Again, copy your App ID
#MDBlocal
1. Open the index.html file
2. Add your App ID (line 8)
3. Go to your app directory
4. Run your app with ‘http-server &’
a) Note: You may need to install http-
server via npm (install with –g flag)
b) You can also use any other method of
opening the dashboard
Now let’s start the Dashboard:
https://docs.mongodb.com/stitch/getting-started/dashboard/
#MDBlocal
Check out your Dashboard!
#MDBlocal
Adding
Authentication
#MDBlocal
1. Go to ‘Authentication’ in the Stitch UI
2. Edit Email/Password configuration
a) Click the slider to enable
b) Set Email Confirmation URL and
Email Reset URL
c) Click ‘Save’
3. Add our first e-mail/password user
a) Click the ‘Users’ tab
b) Click ‘+ Add User’
c) Enter an email address and
password of your choosing and
click ‘Create’
Add E-mail Auth:
#MDBlocal
1. Next go back to ‘Providers’, find ‘API
Key’ authentication and click ‘edit’
a) Click the slider to enable e-
mail/password authentication
b) Click ‘Create API Key,’ assign your
API Key a name, and click ‘Save’
2. Click ‘Show Key...’ and then copy key
Add an API Key:
https://docs.mongodb.com/stitch/getting-started/dashboard/
#MDBlocal
1. Open the data_generator.js file
2. Comment out line 38, Uncomment line 41
3. Add your API Key (line 41)
4. Re-run data_generator.js
Add Auth to the Loader:
https://docs.mongodb.com/stitch/getting-started/dashboard/
#MDBlocal
CheckAuth – Check the authentication type of a
user for a security rule
1. Take an auth type and see if the given suer
matches it.
2. Name function ‘CheckAuth’
3. Set ‘Can Evalutate’ to {}
Add a Function:
https://docs.mongodb.com/stitch/getting-started/dashboard/
#MDBlocal
1. Go to rules under the rules tab of
‘mongodb-atlas’ in Stitch UI
2. In the ‘SalesReporting.Receipts’, edit the
Top-level Document Read and Write rules
(see README)
3. Add the timestamp/total fields into the
namespace
4. In both of these fields, add a read rule to
check a user’s authentication (see
README)
Set-up secure Access
Rules:
#MDBlocal
1. Open the index.html file
2. Comment out line 15, uncomment line 16
3. Re-run data_generator.js
Add Auth to the Dashboard:
https://docs.mongodb.com/stitch/getting-started/dashboard/
#MDBlocal
Check out your Dashboard (Again)!
#MDBlocal
Next Steps
#MDBlocal
• Build out a more robust public API to access your data by adding
more pipelines and webhooks
• Add pipelines and using the data to create more graphs in your
realtime dashboard
• Use one of our integrations to build extra features like e-mail receipts
for customers or a slackbot for placing an order.
• Take the ideas here and building an API or dashboard with your own
data
Have more time?
#MDBlocal
xx
Everywhere
Expand Regional footprint
Available on-premise
Bring any MongoDB
Realtime
Change Streams driven
Event-based pipelines
Dev Tools
App Import/Export Tools
User/Log Management
What’s Next?
#MDBlocal
• Get more info about Stitch at
• Try out Stitch – stitch.mongodb.com
• Check out SDKs and examples
• Code at github.com/MongodbStitch
• Docs at docs.mongodb.com/stitch
• Build the Dashboard or Weather IoT apps in our Tutorials section
• Ask Questions or let us know what you’re building through Intercom
What Now?
#MDBlocal

More Related Content

Similar to MongoDB Stitch Dashboard and API Builder

Implementing Your Full Stack App with MongoDB Stitch (Tutorial)
Implementing Your Full Stack App with MongoDB Stitch (Tutorial)Implementing Your Full Stack App with MongoDB Stitch (Tutorial)
Implementing Your Full Stack App with MongoDB Stitch (Tutorial)MongoDB
 
Building Your First App with MongoDB Stitch
Building Your First App with MongoDB StitchBuilding Your First App with MongoDB Stitch
Building Your First App with MongoDB StitchMongoDB
 
MongoDB.local Dallas 2019: MongoDB Stitch Tutorial
MongoDB.local Dallas 2019: MongoDB Stitch TutorialMongoDB.local Dallas 2019: MongoDB Stitch Tutorial
MongoDB.local Dallas 2019: MongoDB Stitch TutorialMongoDB
 
MongoDB.local Seattle 2019: MongoDB Stitch Tutorial
MongoDB.local Seattle 2019: MongoDB Stitch TutorialMongoDB.local Seattle 2019: MongoDB Stitch Tutorial
MongoDB.local Seattle 2019: MongoDB Stitch TutorialMongoDB
 
MongoDB.local Atlanta: MongoDB Stitch Tutorial
MongoDB.local Atlanta: MongoDB Stitch TutorialMongoDB.local Atlanta: MongoDB Stitch Tutorial
MongoDB.local Atlanta: MongoDB Stitch TutorialMongoDB
 
Validating A Product Key In A Vs
Validating A Product Key In A VsValidating A Product Key In A Vs
Validating A Product Key In A VsRaj Chanchal
 
Presenting Data – An Alternative to the View Control
Presenting Data – An Alternative to the View ControlPresenting Data – An Alternative to the View Control
Presenting Data – An Alternative to the View ControlTeamstudio
 
Getting started-with-oracle-so a-iv
Getting started-with-oracle-so a-ivGetting started-with-oracle-so a-iv
Getting started-with-oracle-so a-ivAmit Sharma
 
IBM Cognos 10 Framework Manager Metadata Modeling: Tips and Tricks
IBM Cognos 10 Framework Manager Metadata Modeling: Tips and TricksIBM Cognos 10 Framework Manager Metadata Modeling: Tips and Tricks
IBM Cognos 10 Framework Manager Metadata Modeling: Tips and TricksSenturus
 
Build a notepad application with PHP, MongoDB, and IBM Bluemix - by Vikram Va...
Build a notepad application with PHP, MongoDB, and IBM Bluemix - by Vikram Va...Build a notepad application with PHP, MongoDB, and IBM Bluemix - by Vikram Va...
Build a notepad application with PHP, MongoDB, and IBM Bluemix - by Vikram Va...Carlos Tomas
 
Magento 2 Best Practice Workfow // David Lambauer // Meet Magento 2017 // Lei...
Magento 2 Best Practice Workfow // David Lambauer // Meet Magento 2017 // Lei...Magento 2 Best Practice Workfow // David Lambauer // Meet Magento 2017 // Lei...
Magento 2 Best Practice Workfow // David Lambauer // Meet Magento 2017 // Lei...AOE
 
Learn to build a CodeIgniter Login and Registration with source code.pdf
Learn to build a CodeIgniter Login and Registration with source code.pdfLearn to build a CodeIgniter Login and Registration with source code.pdf
Learn to build a CodeIgniter Login and Registration with source code.pdfBe Problem Solver
 
Ch-Ch-Ch-Ch-Changes: Taking Your MongoDB Stitch Application to the Next Level...
Ch-Ch-Ch-Ch-Changes: Taking Your MongoDB Stitch Application to the Next Level...Ch-Ch-Ch-Ch-Changes: Taking Your MongoDB Stitch Application to the Next Level...
Ch-Ch-Ch-Ch-Changes: Taking Your MongoDB Stitch Application to the Next Level...MongoDB
 
Building Your First App with MongoDB Stitch
Building Your First App with MongoDB StitchBuilding Your First App with MongoDB Stitch
Building Your First App with MongoDB StitchMongoDB
 
MongoDB World 2018: Ch-Ch-Ch-Ch-Changes: Taking Your Stitch Application to th...
MongoDB World 2018: Ch-Ch-Ch-Ch-Changes: Taking Your Stitch Application to th...MongoDB World 2018: Ch-Ch-Ch-Ch-Changes: Taking Your Stitch Application to th...
MongoDB World 2018: Ch-Ch-Ch-Ch-Changes: Taking Your Stitch Application to th...MongoDB
 
Why Browser Debugger is a Developer's Best Friend
Why Browser Debugger is a Developer's Best FriendWhy Browser Debugger is a Developer's Best Friend
Why Browser Debugger is a Developer's Best FriendOdoo
 
Office 365 Saturday (Sydney) - SharePoint framework – build integrated user e...
Office 365 Saturday (Sydney) - SharePoint framework – build integrated user e...Office 365 Saturday (Sydney) - SharePoint framework – build integrated user e...
Office 365 Saturday (Sydney) - SharePoint framework – build integrated user e...Anupam Ranku
 
Accelerating your application development with IBM BlueMix (Your dream devel...
Accelerating your application development with IBM BlueMix (Your dream devel...Accelerating your application development with IBM BlueMix (Your dream devel...
Accelerating your application development with IBM BlueMix (Your dream devel...Supal Chowdhury
 
Micro services from scratch - Part 1
Micro services from scratch - Part 1Micro services from scratch - Part 1
Micro services from scratch - Part 1Azrul MADISA
 

Similar to MongoDB Stitch Dashboard and API Builder (20)

Implementing Your Full Stack App with MongoDB Stitch (Tutorial)
Implementing Your Full Stack App with MongoDB Stitch (Tutorial)Implementing Your Full Stack App with MongoDB Stitch (Tutorial)
Implementing Your Full Stack App with MongoDB Stitch (Tutorial)
 
Building Your First App with MongoDB Stitch
Building Your First App with MongoDB StitchBuilding Your First App with MongoDB Stitch
Building Your First App with MongoDB Stitch
 
MongoDB.local Dallas 2019: MongoDB Stitch Tutorial
MongoDB.local Dallas 2019: MongoDB Stitch TutorialMongoDB.local Dallas 2019: MongoDB Stitch Tutorial
MongoDB.local Dallas 2019: MongoDB Stitch Tutorial
 
MongoDB.local Seattle 2019: MongoDB Stitch Tutorial
MongoDB.local Seattle 2019: MongoDB Stitch TutorialMongoDB.local Seattle 2019: MongoDB Stitch Tutorial
MongoDB.local Seattle 2019: MongoDB Stitch Tutorial
 
MongoDB.local Atlanta: MongoDB Stitch Tutorial
MongoDB.local Atlanta: MongoDB Stitch TutorialMongoDB.local Atlanta: MongoDB Stitch Tutorial
MongoDB.local Atlanta: MongoDB Stitch Tutorial
 
Validating A Product Key In A Vs
Validating A Product Key In A VsValidating A Product Key In A Vs
Validating A Product Key In A Vs
 
Presenting Data – An Alternative to the View Control
Presenting Data – An Alternative to the View ControlPresenting Data – An Alternative to the View Control
Presenting Data – An Alternative to the View Control
 
Getting started-with-oracle-so a-iv
Getting started-with-oracle-so a-ivGetting started-with-oracle-so a-iv
Getting started-with-oracle-so a-iv
 
IBM Cognos 10 Framework Manager Metadata Modeling: Tips and Tricks
IBM Cognos 10 Framework Manager Metadata Modeling: Tips and TricksIBM Cognos 10 Framework Manager Metadata Modeling: Tips and Tricks
IBM Cognos 10 Framework Manager Metadata Modeling: Tips and Tricks
 
Build a notepad application with PHP, MongoDB, and IBM Bluemix - by Vikram Va...
Build a notepad application with PHP, MongoDB, and IBM Bluemix - by Vikram Va...Build a notepad application with PHP, MongoDB, and IBM Bluemix - by Vikram Va...
Build a notepad application with PHP, MongoDB, and IBM Bluemix - by Vikram Va...
 
ASP DOT NET
ASP DOT NETASP DOT NET
ASP DOT NET
 
Magento 2 Best Practice Workfow // David Lambauer // Meet Magento 2017 // Lei...
Magento 2 Best Practice Workfow // David Lambauer // Meet Magento 2017 // Lei...Magento 2 Best Practice Workfow // David Lambauer // Meet Magento 2017 // Lei...
Magento 2 Best Practice Workfow // David Lambauer // Meet Magento 2017 // Lei...
 
Learn to build a CodeIgniter Login and Registration with source code.pdf
Learn to build a CodeIgniter Login and Registration with source code.pdfLearn to build a CodeIgniter Login and Registration with source code.pdf
Learn to build a CodeIgniter Login and Registration with source code.pdf
 
Ch-Ch-Ch-Ch-Changes: Taking Your MongoDB Stitch Application to the Next Level...
Ch-Ch-Ch-Ch-Changes: Taking Your MongoDB Stitch Application to the Next Level...Ch-Ch-Ch-Ch-Changes: Taking Your MongoDB Stitch Application to the Next Level...
Ch-Ch-Ch-Ch-Changes: Taking Your MongoDB Stitch Application to the Next Level...
 
Building Your First App with MongoDB Stitch
Building Your First App with MongoDB StitchBuilding Your First App with MongoDB Stitch
Building Your First App with MongoDB Stitch
 
MongoDB World 2018: Ch-Ch-Ch-Ch-Changes: Taking Your Stitch Application to th...
MongoDB World 2018: Ch-Ch-Ch-Ch-Changes: Taking Your Stitch Application to th...MongoDB World 2018: Ch-Ch-Ch-Ch-Changes: Taking Your Stitch Application to th...
MongoDB World 2018: Ch-Ch-Ch-Ch-Changes: Taking Your Stitch Application to th...
 
Why Browser Debugger is a Developer's Best Friend
Why Browser Debugger is a Developer's Best FriendWhy Browser Debugger is a Developer's Best Friend
Why Browser Debugger is a Developer's Best Friend
 
Office 365 Saturday (Sydney) - SharePoint framework – build integrated user e...
Office 365 Saturday (Sydney) - SharePoint framework – build integrated user e...Office 365 Saturday (Sydney) - SharePoint framework – build integrated user e...
Office 365 Saturday (Sydney) - SharePoint framework – build integrated user e...
 
Accelerating your application development with IBM BlueMix (Your dream devel...
Accelerating your application development with IBM BlueMix (Your dream devel...Accelerating your application development with IBM BlueMix (Your dream devel...
Accelerating your application development with IBM BlueMix (Your dream devel...
 
Micro services from scratch - Part 1
Micro services from scratch - Part 1Micro services from scratch - Part 1
Micro services from scratch - Part 1
 

More from MongoDB

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

More from MongoDB (20)

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

MongoDB Stitch Dashboard and API Builder

  • 1. #MDBlocal Today’s Pre-Reqs For today’s workshop you’ll need the following: ● Computer ○ Preferably a Mac ○ Or a working knowledge of Windows + NodeJS ● MongoDB Atlas Cluster running 3.4+ (can be free tier) ● NodeJS 6.0+/npm ● Important: ○ Files: https://github.com/mongodb/stitch-examples ■ Under ‘Dashboard’ ○ Documentation: https://docs.mongodb.com/stitch/getting-started/dashboard/
  • 3. #MDBlocal Agenda for this Workshop: Intro to Stitch + Atlas What we’ll work on today Creating a simple API Building a D3 Dashboard Adding Authentication Next steps with Stitch 01 02 03 04 05 06
  • 4. #MDBlocal Today’s Pre-Reqs For today’s workshop you’ll need the following: ● Computer ○ Preferably a Mac ○ Or a working knowledge of Windows + NodeJS ● NodeJS/npm ● Important: Get the files/README (https://goo.gl/CU1JV1)
  • 6. #MDBE17 MongoDB Query Language + Native DriversIntegrated Rules Pipelines 3rd Party Services Native SDKs (iOS, Android, JS) Rest-like API https://docs.mongodb.com/stitch/getting-started/dashboard/
  • 7. #MDBE17 Stitch let’s you control the flow of data: Integrated services and Pipelines for complex, multi-stage workflows Native SDKs for Android, JS, and iOS clients Direct Database Access https://docs.mongodb.com/stitch/getting-started/dashboard/
  • 9. #MDBlocal https://mongodb.com/atlas – Sign up, free. https://docs.mongodb.com/stitch/getting-started/dashboard/
  • 10. #MDBlocal Launch the cluster (Remember your password!)
  • 13. #MDBlocal Our Data *Point-of-sale data from a Pizza shop (But Similar to Point-of-Sale, Log, Telemetry, etc. data you would see elsewhere) * Our Goal https://docs.mongodb.com/stitch/getting-started/dashboard/
  • 14. #MDBlocal 1. Data enters through Stitch, flows into Atlas 2. Stitch can augment data loading: a) Grabbing extra data from an external API b) Taking an action on load (e-mail receipt) 3. Can expose data through API, Web/mobile app, or Atlas (Remember: You can also use Stitch with an existing database too) Behind the scenes, Stitch connects Everything Dash + Auth MongoDB Stitch MongoDB Atlas Sales Data API Access https://docs.mongodb.com/stitch/getting-started/dashboard/
  • 16. #MDBlocal Click ‘Stitch Apps’ in Atlas https://docs.mongodb.com/stitch/getting-started/dashboard/
  • 20. #MDBlocal Next, let’s add the Receipts Collection
  • 22. #MDBlocal In Stitch, you opt-in each namespace in your database separately for access. 1. Go to SalesReporting.Receipts namespace 2. Delete the default Filter under ‘Filters’ 3. Delete the default rules (including Owner Id field rules) 4. Set the Top-level Document Read/Write rules to {} 5. This enables Public read/write to this namespace only Next, set-up simple Access Rules: https://docs.mongodb.com/stitch/getting-started/dashboard/
  • 23. #MDBlocal Now let’s load data: 1. Open the data_generator.js file 2. Add your App ID (line 10) 3. Run data_generator.js 4. Watch data load into Stitch! https://docs.mongodb.com/stitch/getting-started/dashboard/
  • 25. #MDBlocal In Stitch, you can add a number of predefined services to your app. Services have predefined actions to ease integration. We’ll use the HTTP Service to create an API to our data 1. Click ‘Add Service’ 2. Click ‘HTTP’ and name your service ‘SalesAPI’ Create a HTTP Service:
  • 26. #MDBlocal Create a Webhook: For the HTTP service, you can create an incoming webhook that will execute a function in response to a request. 1. Within AggregateToppings, click ‘New Webhook’ 2. Name your new webhook ‘GetSales’ 3. Switch ‘Respond with Result’ ON 4. Click ‘Require Secret as Query Param’ 5. Set Secret to ‘SECRET’
  • 27. #MDBlocal Get the distribution of toppings for the last 100 pizzas. 1. Function that uses aggregation to: a) Sort the orders in descending time order b) Limit the number of orders to 100 c) Group the orders by topping Add a Function to the Webhook: https://docs.mongodb.com/stitch/getting-started/dashboard/
  • 28. #MDBlocal Now you can access your data via HTTP! curl -X POST -H [WEBHOOK_URL]?secret=[SECRET] | python -m json.tool
  • 30. #MDBlocal Add a Function: SalesTimeline – Get the sales for a given time interval 1. Find all the sales in a certain timeframe a) Projects fields down to just timestamp/total b) Sorts by timestamp c) Limits to 100 documents 2. Make sure function is named ‘SalesTimeline’ 3. Set ‘Can Evaluate’ to {}
  • 32. #MDBlocal 1. Open the index.html file 2. Add your App ID (line 8) 3. Go to your app directory 4. Run your app with ‘http-server &’ a) Note: You may need to install http- server via npm (install with –g flag) b) You can also use any other method of opening the dashboard Now let’s start the Dashboard: https://docs.mongodb.com/stitch/getting-started/dashboard/
  • 35. #MDBlocal 1. Go to ‘Authentication’ in the Stitch UI 2. Edit Email/Password configuration a) Click the slider to enable b) Set Email Confirmation URL and Email Reset URL c) Click ‘Save’ 3. Add our first e-mail/password user a) Click the ‘Users’ tab b) Click ‘+ Add User’ c) Enter an email address and password of your choosing and click ‘Create’ Add E-mail Auth:
  • 36. #MDBlocal 1. Next go back to ‘Providers’, find ‘API Key’ authentication and click ‘edit’ a) Click the slider to enable e- mail/password authentication b) Click ‘Create API Key,’ assign your API Key a name, and click ‘Save’ 2. Click ‘Show Key...’ and then copy key Add an API Key: https://docs.mongodb.com/stitch/getting-started/dashboard/
  • 37. #MDBlocal 1. Open the data_generator.js file 2. Comment out line 38, Uncomment line 41 3. Add your API Key (line 41) 4. Re-run data_generator.js Add Auth to the Loader: https://docs.mongodb.com/stitch/getting-started/dashboard/
  • 38. #MDBlocal CheckAuth – Check the authentication type of a user for a security rule 1. Take an auth type and see if the given suer matches it. 2. Name function ‘CheckAuth’ 3. Set ‘Can Evalutate’ to {} Add a Function: https://docs.mongodb.com/stitch/getting-started/dashboard/
  • 39. #MDBlocal 1. Go to rules under the rules tab of ‘mongodb-atlas’ in Stitch UI 2. In the ‘SalesReporting.Receipts’, edit the Top-level Document Read and Write rules (see README) 3. Add the timestamp/total fields into the namespace 4. In both of these fields, add a read rule to check a user’s authentication (see README) Set-up secure Access Rules:
  • 40. #MDBlocal 1. Open the index.html file 2. Comment out line 15, uncomment line 16 3. Re-run data_generator.js Add Auth to the Dashboard: https://docs.mongodb.com/stitch/getting-started/dashboard/
  • 41. #MDBlocal Check out your Dashboard (Again)!
  • 43. #MDBlocal • Build out a more robust public API to access your data by adding more pipelines and webhooks • Add pipelines and using the data to create more graphs in your realtime dashboard • Use one of our integrations to build extra features like e-mail receipts for customers or a slackbot for placing an order. • Take the ideas here and building an API or dashboard with your own data Have more time?
  • 44. #MDBlocal xx Everywhere Expand Regional footprint Available on-premise Bring any MongoDB Realtime Change Streams driven Event-based pipelines Dev Tools App Import/Export Tools User/Log Management What’s Next?
  • 45. #MDBlocal • Get more info about Stitch at • Try out Stitch – stitch.mongodb.com • Check out SDKs and examples • Code at github.com/MongodbStitch • Docs at docs.mongodb.com/stitch • Build the Dashboard or Weather IoT apps in our Tutorials section • Ask Questions or let us know what you’re building through Intercom What Now?