SlideShare ist ein Scribd-Unternehmen logo
1 von 46
#MDBlocal
Today’s Pre-Reqs
For today’s workshop you’ll need the following:
● Computer
● NodeJS 6.0+
● Important:
○ Files: https://github.com/mongodb/stitch-examples
■ Under ‘Dashboard’
○ Documentation: https://docs.mongodb.com/stitch/getting-started/dashboard/
#MDBlocal
#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
● NodeJS 6.0+
● Important:
○ Files: https://github.com/mongodb/stitch-examples
■ Under ‘Dashboard’
○ Documentation: https://docs.mongodb.com/stitch/getting-started/dashboard/
#MDBlocal
Intro to Stitch
#MDBlocal
MongoDB Query Language + Native DriversIntegrated Rules
Functions 3rd Party Services
Native SDKs (iOS, Android, JS)
Rest-like API
https://docs.mongodb.com/stitch/getting-started/dashboard/
#MDBlocal
Stitch let’s you control the flow of data:
Integrated services and
functions 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 ‘Services’
2. Click ‘Add a Service’
3. 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 18)
3. Go to your app directory
4. Run your app with npm start or
‘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 40, Uncomment line 43
3. Add your API Key (line 43)
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 10, uncomment line 11
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 functions and webhooks
• Add functions and use 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 Functions
Improve Dev
App Import/Export Tools
User/Log Management
Rules Usability
What’s Next?
#MDBlocal
• 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
THANK YOU
FOR JOINING!

Weitere ähnliche Inhalte

Was ist angesagt?

Was ist angesagt? (20)

Webinar: Building a Blockchain Database with MongoDB
Webinar: Building a Blockchain Database with MongoDBWebinar: Building a Blockchain Database with MongoDB
Webinar: Building a Blockchain Database with MongoDB
 
Mongodb Spring
Mongodb SpringMongodb Spring
Mongodb Spring
 
MongoDB .local Chicago 2019: A MongoDB Journey: Moving from a relational data...
MongoDB .local Chicago 2019: A MongoDB Journey: Moving from a relational data...MongoDB .local Chicago 2019: A MongoDB Journey: Moving from a relational data...
MongoDB .local Chicago 2019: A MongoDB Journey: Moving from a relational data...
 
[MongoDB.local Bengaluru 2018] Jumpstart: Introduction to Schema Design
[MongoDB.local Bengaluru 2018] Jumpstart: Introduction to Schema Design[MongoDB.local Bengaluru 2018] Jumpstart: Introduction to Schema Design
[MongoDB.local Bengaluru 2018] Jumpstart: Introduction to Schema Design
 
Jumpstart: Introduction to Schema Design
Jumpstart: Introduction to Schema DesignJumpstart: Introduction to Schema Design
Jumpstart: Introduction to Schema Design
 
Globally Distributed RESTful Object Storage
Globally Distributed RESTful Object Storage Globally Distributed RESTful Object Storage
Globally Distributed RESTful Object Storage
 
Operationalizing the Value of MongoDB: The MetLife Experience
Operationalizing the Value of MongoDB: The MetLife ExperienceOperationalizing the Value of MongoDB: The MetLife Experience
Operationalizing the Value of MongoDB: The MetLife Experience
 
Architecture blockchain-azure
Architecture blockchain-azureArchitecture blockchain-azure
Architecture blockchain-azure
 
Digital Ethics and Privacy in a GDPR World
Digital Ethics and Privacy in a GDPR WorldDigital Ethics and Privacy in a GDPR World
Digital Ethics and Privacy in a GDPR World
 
Data Analytics: Understanding Your MongoDB Data
Data Analytics: Understanding Your MongoDB DataData Analytics: Understanding Your MongoDB Data
Data Analytics: Understanding Your MongoDB Data
 
MongoDB Days Silicon Valley: Jumpstart: The Right and Wrong Use Cases for Mon...
MongoDB Days Silicon Valley: Jumpstart: The Right and Wrong Use Cases for Mon...MongoDB Days Silicon Valley: Jumpstart: The Right and Wrong Use Cases for Mon...
MongoDB Days Silicon Valley: Jumpstart: The Right and Wrong Use Cases for Mon...
 
Webinar: Introducing the MongoDB Connector for BI 2.0 with Tableau
Webinar: Introducing the MongoDB Connector for BI 2.0 with TableauWebinar: Introducing the MongoDB Connector for BI 2.0 with Tableau
Webinar: Introducing the MongoDB Connector for BI 2.0 with Tableau
 
Advanced applications with MongoDB
Advanced applications with MongoDBAdvanced applications with MongoDB
Advanced applications with MongoDB
 
Webinar: Elevate Your Enterprise Architecture with In-Memory Computing
Webinar: Elevate Your Enterprise Architecture with In-Memory ComputingWebinar: Elevate Your Enterprise Architecture with In-Memory Computing
Webinar: Elevate Your Enterprise Architecture with In-Memory Computing
 
MongoDB and Azure Data Bricks - Microsoft
MongoDB and Azure Data Bricks - MicrosoftMongoDB and Azure Data Bricks - Microsoft
MongoDB and Azure Data Bricks - Microsoft
 
Decentralization of internet of things with blockchain architecture
Decentralization of internet of things with blockchain architectureDecentralization of internet of things with blockchain architecture
Decentralization of internet of things with blockchain architecture
 
Tutorial: Building Your First App with MongoDB Stitch
Tutorial: Building Your First App with MongoDB StitchTutorial: Building Your First App with MongoDB Stitch
Tutorial: Building Your First App with MongoDB Stitch
 
Addressing Your Backup Needs Using Ops Manager and Atlas
Addressing Your Backup Needs Using Ops Manager and AtlasAddressing Your Backup Needs Using Ops Manager and Atlas
Addressing Your Backup Needs Using Ops Manager and Atlas
 
Jumpstart: Introduction to MongoDB
Jumpstart: Introduction to MongoDBJumpstart: Introduction to MongoDB
Jumpstart: Introduction to MongoDB
 
MongoDB .local Chicago 2019: Using MongoDB Transactions to Implement Cryptogr...
MongoDB .local Chicago 2019: Using MongoDB Transactions to Implement Cryptogr...MongoDB .local Chicago 2019: Using MongoDB Transactions to Implement Cryptogr...
MongoDB .local Chicago 2019: Using MongoDB Transactions to Implement Cryptogr...
 

Ähnlich wie Implementing Your Full Stack App with MongoDB Stitch (Tutorial)

SH 2 - SES 1 - Stitch_Workshop_TLV.pptx
SH 2 - SES 1 - Stitch_Workshop_TLV.pptxSH 2 - SES 1 - Stitch_Workshop_TLV.pptx
SH 2 - SES 1 - Stitch_Workshop_TLV.pptx
MongoDB
 
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
Raj Chanchal
 
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
Amit Sharma
 
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
Amit Sharma
 

Ähnlich wie Implementing Your Full Stack App with MongoDB Stitch (Tutorial) (20)

SH 2 - SES 1 - Stitch_Workshop_TLV.pptx
SH 2 - SES 1 - Stitch_Workshop_TLV.pptxSH 2 - SES 1 - Stitch_Workshop_TLV.pptx
SH 2 - SES 1 - Stitch_Workshop_TLV.pptx
 
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
 
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...
 
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...
 
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
 
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
 
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
 
Customer Automation Masterclass - Workshop 1: Data Enrichment using Clearbit
Customer Automation Masterclass - Workshop 1: Data Enrichment using ClearbitCustomer Automation Masterclass - Workshop 1: Data Enrichment using Clearbit
Customer Automation Masterclass - Workshop 1: Data Enrichment using Clearbit
 
Expedite the development lifecycle with MongoDB and serverless - DEM02 - Sant...
Expedite the development lifecycle with MongoDB and serverless - DEM02 - Sant...Expedite the development lifecycle with MongoDB and serverless - DEM02 - Sant...
Expedite the development lifecycle with MongoDB and serverless - DEM02 - Sant...
 
Yes, It's Number One it's TOTP!
Yes, It's Number One it's TOTP!Yes, It's Number One it's TOTP!
Yes, It's Number One it's TOTP!
 
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
 
Micro services from scratch - Part 1
Micro services from scratch - Part 1Micro services from scratch - Part 1
Micro services from scratch - Part 1
 
Moscow MuleSoft meetup May 2021
Moscow MuleSoft meetup May 2021Moscow MuleSoft meetup May 2021
Moscow MuleSoft meetup May 2021
 
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...
 

Mehr von MongoDB

Mehr von MongoDB (20)

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

Kürzlich hochgeladen

Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 

Kürzlich hochgeladen (20)

Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 

Implementing Your Full Stack App with MongoDB Stitch (Tutorial)

  • 1. #MDBlocal Today’s Pre-Reqs For today’s workshop you’ll need the following: ● Computer ● NodeJS 6.0+ ● 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 ● NodeJS 6.0+ ● Important: ○ Files: https://github.com/mongodb/stitch-examples ■ Under ‘Dashboard’ ○ Documentation: https://docs.mongodb.com/stitch/getting-started/dashboard/
  • 6. #MDBlocal MongoDB Query Language + Native DriversIntegrated Rules Functions 3rd Party Services Native SDKs (iOS, Android, JS) Rest-like API https://docs.mongodb.com/stitch/getting-started/dashboard/
  • 7. #MDBlocal Stitch let’s you control the flow of data: Integrated services and functions 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 ‘Services’ 2. Click ‘Add a Service’ 3. 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 18) 3. Go to your app directory 4. Run your app with npm start or ‘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 40, Uncomment line 43 3. Add your API Key (line 43) 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 10, uncomment line 11 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 functions and webhooks • Add functions and use 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 Functions Improve Dev App Import/Export Tools User/Log Management Rules Usability What’s Next?
  • 45. #MDBlocal • 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?