SlideShare une entreprise Scribd logo
1  sur  30
#MDBlocal
MongoDB Stitch Introduction
Drew DiPalma, Product Manager
#MDBlocal
When building, you need to…
1. Safely and easily access data
2. Integrate with key services
3. Scalably serve requests
#MDBlocal
MongoDB Query Language + Native DriversIntegrated Rules
Functions3rd Party Services
Native SDKs (JavaScript, Android, iOS)
Rest-like API
#MDBlocal
Integrated services and
Functions for complex,
connection logic
Native SDKs for Android,
JS, and iOS clients
Direct Database
Access
#MDBlocal
How requests work…
1. Application request is made
1
#MDBlocal
How requests work…
1. Application request is made
2. Stitch parses and applies rules
2
#MDBlocal
How requests work…
1. Application request is made
2. Stitch parses and applies rules
3. Stitch orchestrates DB + Services
3
3
#MDBlocal
How requests work…
1. Application request is made
2. Stitch parses and applies rules
3. Stitch orchestrates DB + Services
4. Stitch aggregates and applies rules
4
#MDBlocal
How requests work…
1. Application request is made
2. Stitch parses and applies rules
3. Stitch orchestrates DB + Services
4. Stitch aggregates and applies rules
5. Client receives results 5
const stitch = require('mongodb-stitch');
let client, mongodb, coll, users;
stitch.StitchClientFactory
.create('APP-ID')
.then(stitchClient => {
client = stitchClient;
mongodb = client.service('mongodb', 'mongodb-atlas');
coll = mongodb.db('Demo').collection(’Users');
});
MongoDB Services Functions
Stitch Concepts
client.login().then(() => {
// You can use client.authenticate() to access other auth providers
client.authenticate('providerType', {options})
// Providers include:
// - Anonymous
// - Email/Password
// - Facebook
// - Google
// - API Keys
// - Custom (signed JWT)
MongoDB Services Functions
Stitch Concepts
client.login().then(() => {
coll.find({'city': 'Seattle'}).execute().then(docs => {
users = docs;
});
});
// Or execute almost any find/aggregate command
coll.find({'city': 'Seattle'})
.aggregate([…])
.count(…)
.deleteMany(…)
.deleteOne(…)
.insertMany(…)
.insertOne(…)
.updateMany(…)
.updateOne(…)
MongoDB Services Functions
Stitch Concepts
const twilioService = client.service('twilio', 'twilioService')
twilioService.send('+120155555553', '+12018675309', message)
const sesService = client.service('ses', 'sesService')
sesService.send(fromEmail, toEmail, message)
const s3Service = client.service('s3', 's3Service')
s3Service.put(bucket, key, acl, contentType)
MongoDB Services Functions
Stitch Concepts
#MDBlocal
• Scalable, hosted JavaScript functions
• Written using ECMAScript 5
• Easily incorporate application context
- context.values
- context.services
- context.user
- context.request
- context.functions
- context.utils
Stitch Functions
client.executeFunction('sendWeather', 'Seattle');
MongoDB Services Functions
Stitch Concepts
client.executeFunction('sendWeather', 'Seattle');
MongoDB Services Functions
Stitch Concepts
//Function sendweather
exports = function(city) {
var mongodb = context.services.get("mongodb-atlas");
var UserColl = mongodb.db("StitchDemo").collection("Users");
var twilio = context.services.get("twilio");
var weather = context.services.get("weatherAPI");
var users = UserColl.find({"city": city});
var forecast = weather.get({context.values.get("weatherURL") + city});
var statuses = [];
for(var i in users){
statuses.push(twilio.send(context.values.get("twilioPhone")), users[i].Phone, forecast);
}
return statuses;
}
#MDBlocal
• Control DB/Service/Function access
• Fine-grained data access controls
• Define with simple JSON or link to
functions
• Associate with user profile, MDB Data,
or external info
Declarative Access Controls
#MDBlocal
Atlas
Customer Account Data
{
"owner_id": … ,
"balance": … ,
"transactions": {…},
"user_profile": {….}
}Bank
Teller
Analys
t
Custome
r
Roles,Permissions,andSecurity
Application
Reporting Data Mart
User Profile:
“I need to access my account”
Role Based:
“I need to lookup transactions
without seeing personal information”
Aggregate Only:
“I need to understand the bank’s total
cash flow”
#MDBlocal
Bank
Teller
Analys
t
Custome
r
Atlas
Customer Account Data
{
"owner_id": … ,
"balance": … ,
"transactions": {…},
"user_profile": {….}
}
Stitch
user_profile
(Read Rule)
{”owner_id": ”%%user.id"}
balance/transactions
(Read Rules)
{
”%or": [
{”owner_id": ”%%user.id"},
{"%%true": { "%function":
{ "name": ”isTeller",
"args": []
}
]
}
{
"user_id": … ,
"balance": … ,
"transactions":
{…},
"user_profile": {….}
}
#MDBlocal
Stitch
user_profile
(Read Rule)
{”owner_id": ”%%user.id"}
balance/transactions
(Read Rules)
{
”%or": [
{”owner_id": ”%%user.id"},
{"%%true": { "%function":
{ "name": ”isTeller",
"args": []
}
]
}
Bank
Teller
Analys
t
Custome
r
Atlas
Customer Account Data
{
"owner_id": … ,
"balance": … ,
"transactions": {…},
"user_profile": {….}
}
{
"user_id": … ,
"balance": … ,
"transactions": {…}
}
#MDBlocal
Stitch
user_profile
(Read Rule)
{”owner_id": ”%%user.id"}
balance/transactions
(Read Rules)
{
”%or": [
{”owner_id": ”%%user.id"},
{"%%true": { "%pipeline":
{ "name": "CheckAuth",
"args": { "AuthType": "server",
"UserAuth": "%%user.type"}
}
]
}
Stitch
user_profile
(Read Rule)
{”owner_id": ”%%user.id"}
balance/transactions
(Read Rules)
{
”%or": [
{”owner_id": ”%%user.id"},
{"%%true": { "%function":
{ "name": ”isTeller",
"args": []
}
]
}
Bank
Teller
Analys
t
Custome
r
{Aggregated
Data}
Stitch
Function for Analysis
{
"%%true": { "%function":
{ "name": ”isAnalyst",
"args": []}
}
Atlas
Customer Account Data
{
"owner_id": … ,
"balance": … ,
"transactions": {…},
"user_profile": {….}
}
#MDBlocal
Stitch in Action
#MDBlocal
Amazon S3 MongoDB
Atlas
twilio Amazon
Rekognition
2FA Access Control with Stitch
Secure IoT Client
• Bi-directional communication
• Secure com via API key auth
• Device access to DB,
functions and Services
Complex, Scalable Backend
• Deeply integrated services
• Coordination logic via
Functions
• Security through Auth + Rules
• Elastic scale
#MDBlocal
MongoDB
Atlas
Twilio
Amazon
Rekognition
{key: “*”}
capture_image()
{match: Drew,
Prob: 99.0%}
{user: “Drew”,
Ph#: 555-1212}
{user: Drew,
OTP: 135}
{user: Drew,
OTP: 135}
Ph#: 555-1212
{Ph#: 555-1212,
OTP: 135}
{OTP: 135}
{OTP: 135}
Amazon S3
process:
1. User requests photo + SMS
entry
2. Stitch asks ElectricImp for
photo
3. EI takes photo, sends to
Stitch
4. Stitch sends the photo to
AWS S3 and Rekognition
5. Rekognition sends image
analysis
6. Stitch queries Atlas for User
7. Stitch generates an entry
code, writes log, sends text
via Twilio
8. User enters code with key
pad, ElectricImp sends to
Stitch
9. Stitch checks code against
logs
10. If the code is valid, the Stitch
sends Electric Imp a message
to unlock.
#MDBlocal
Stitch Demo
#MDBlocal
Add Features
• Take your app to a
new platform
• Build a better
permissions
system or a
separate admin
portal
• Add additional
authentication
providers
Expose Data
• Provide an API for
safe, internal data
access
• Build more precise
permissions
system
• Create a real-time
dashboard with
authentication and
security built-in
Integrate Services
• Integrate with any
service or API with
minimal code
• Consume/action on
data in real time
with webhooks
• Communicate with
data using text,
e-mail, etc.
Complete
Backend
• Build faster without
boilerplate code
• Easily span multiple
platforms
• Scale at a moments
notice
• Single, simplified
point to manage
infrastructure/logic
#MDBlocal
• $1 per GB of data transferred from Stitch to client/service
• 25 GB Free per month
• Data transfer to Atlas is free
Pricing
#MDBlocal
xx
Everywher
e
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
• Check out our hands-on lab: 12:50PM in the Sound Room
• 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!

Contenu connexe

Tendances

Tendances (20)

CQRS and Event Sourcing with MongoDB and PHP
CQRS and Event Sourcing with MongoDB and PHPCQRS and Event Sourcing with MongoDB and PHP
CQRS and Event Sourcing with MongoDB and PHP
 
[MongoDB.local Bengaluru 2018] Just in Time Validation with JSON Schema
[MongoDB.local Bengaluru 2018] Just in Time Validation with JSON Schema[MongoDB.local Bengaluru 2018] Just in Time Validation with JSON Schema
[MongoDB.local Bengaluru 2018] Just in Time Validation with JSON Schema
 
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...
 
Mobile on AWS
Mobile on AWSMobile on AWS
Mobile on AWS
 
A serverless IoT story from design to production and monitoring
A serverless IoT story from design to production and monitoringA serverless IoT story from design to production and monitoring
A serverless IoT story from design to production and monitoring
 
NGSIv2 Overview for Developers That Already Know NGSIv1
NGSIv2 Overview for Developers That Already Know NGSIv1NGSIv2 Overview for Developers That Already Know NGSIv1
NGSIv2 Overview for Developers That Already Know NGSIv1
 
Event sourcing with Eventuate
Event sourcing with EventuateEvent sourcing with Eventuate
Event sourcing with Eventuate
 
Integrating an App with Amazon Web Services SimpleDB - A Matter of Choices
Integrating an App with Amazon Web Services SimpleDB - A Matter of ChoicesIntegrating an App with Amazon Web Services SimpleDB - A Matter of Choices
Integrating an App with Amazon Web Services SimpleDB - A Matter of Choices
 
Amazon Cognito + Lambda + S3 + IAM
Amazon Cognito + Lambda + S3 + IAM Amazon Cognito + Lambda + S3 + IAM
Amazon Cognito + Lambda + S3 + IAM
 
IBM Index Conference - 10 steps to build token based API Security
IBM Index Conference - 10 steps to build token based API SecurityIBM Index Conference - 10 steps to build token based API Security
IBM Index Conference - 10 steps to build token based API Security
 
MongoDB Stich Overview
MongoDB Stich OverviewMongoDB Stich Overview
MongoDB Stich Overview
 
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...
 
Intro to Firebase Realtime Database and Authentication
Intro to Firebase Realtime Database and AuthenticationIntro to Firebase Realtime Database and Authentication
Intro to Firebase Realtime Database and Authentication
 
Async
AsyncAsync
Async
 
MongoDB .local Toronto 2019: MongoDB Atlas Search Deep Dive
MongoDB .local Toronto 2019: MongoDB Atlas Search Deep DiveMongoDB .local Toronto 2019: MongoDB Atlas Search Deep Dive
MongoDB .local Toronto 2019: MongoDB Atlas Search Deep Dive
 
Building Mobile Apps on AWS at Websummit Diublin
Building Mobile Apps on AWS at Websummit DiublinBuilding Mobile Apps on AWS at Websummit Diublin
Building Mobile Apps on AWS at Websummit Diublin
 
Http session (Java)
Http session (Java)Http session (Java)
Http session (Java)
 
NodeJS: the good parts? A skeptic’s view (jax jax2013)
NodeJS: the good parts? A skeptic’s view (jax jax2013)NodeJS: the good parts? A skeptic’s view (jax jax2013)
NodeJS: the good parts? A skeptic’s view (jax jax2013)
 
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...
 
NGSIv2 Overview for Developers That Already Know NGSIv1 20180716
NGSIv2 Overview for Developers That Already Know NGSIv1 20180716NGSIv2 Overview for Developers That Already Know NGSIv1 20180716
NGSIv2 Overview for Developers That Already Know NGSIv1 20180716
 

Similaire à Building Your First App with MongoDB Stitch

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
 

Similaire à Building Your First App with MongoDB Stitch (20)

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
 
Evolving your Data Access with MongoDB Stitch - Drew Di Palma
Evolving your Data Access with MongoDB Stitch - Drew Di PalmaEvolving your Data Access with MongoDB Stitch - Drew Di Palma
Evolving your Data Access with MongoDB Stitch - Drew Di Palma
 
MongoDB.local Sydney: Evolving your Data Access with MongoDB Stitch
MongoDB.local Sydney: Evolving your Data Access with MongoDB StitchMongoDB.local Sydney: Evolving your Data Access with MongoDB Stitch
MongoDB.local Sydney: Evolving your Data Access with MongoDB Stitch
 
Faites évoluer votre accès aux données avec MongoDB Stitch
Faites évoluer votre accès aux données avec MongoDB StitchFaites évoluer votre accès aux données avec MongoDB Stitch
Faites évoluer votre accès aux données avec MongoDB Stitch
 
MongoDB Stitch Introduction
MongoDB Stitch IntroductionMongoDB Stitch Introduction
MongoDB Stitch Introduction
 
Introducing Stitch
Introducing Stitch Introducing Stitch
Introducing Stitch
 
Introducing MongoDB Stitch, Backend-as-a-Service from MongoDB
Introducing MongoDB Stitch, Backend-as-a-Service from MongoDBIntroducing MongoDB Stitch, Backend-as-a-Service from MongoDB
Introducing MongoDB Stitch, Backend-as-a-Service from MongoDB
 
Metaverse and Digital Twins on Enterprise-Public.pdf
Metaverse and Digital Twins on Enterprise-Public.pdfMetaverse and Digital Twins on Enterprise-Public.pdf
Metaverse and Digital Twins on Enterprise-Public.pdf
 
MongoDB.local Austin 2018: Ch-Ch-Ch-Ch-Changes: Taking Your MongoDB Stitch A...
MongoDB.local Austin 2018:  Ch-Ch-Ch-Ch-Changes: Taking Your MongoDB Stitch A...MongoDB.local Austin 2018:  Ch-Ch-Ch-Ch-Changes: Taking Your MongoDB Stitch A...
MongoDB.local Austin 2018: Ch-Ch-Ch-Ch-Changes: Taking Your MongoDB Stitch A...
 
Ibm xamarin gtruty
Ibm xamarin gtrutyIbm xamarin gtruty
Ibm xamarin gtruty
 
MongoDB.local Dallas 2019: Pissing Off IT and Delivery: A Tale of 2 ODS's
MongoDB.local Dallas 2019: Pissing Off IT and Delivery: A Tale of 2 ODS'sMongoDB.local Dallas 2019: Pissing Off IT and Delivery: A Tale of 2 ODS's
MongoDB.local Dallas 2019: Pissing Off IT and Delivery: A Tale of 2 ODS's
 
Medium TechTalk — iOS
Medium TechTalk — iOSMedium TechTalk — iOS
Medium TechTalk — iOS
 
MongoDB .local Paris 2020: Les bonnes pratiques pour sécuriser MongoDB
MongoDB .local Paris 2020: Les bonnes pratiques pour sécuriser MongoDBMongoDB .local Paris 2020: Les bonnes pratiques pour sécuriser MongoDB
MongoDB .local Paris 2020: Les bonnes pratiques pour sécuriser MongoDB
 
MongoDB Mobile
MongoDB Mobile MongoDB Mobile
MongoDB Mobile
 
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
 
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)
 
Frontend APIs powering fast paced product iterations
Frontend APIs powering fast paced product iterationsFrontend APIs powering fast paced product iterations
Frontend APIs powering fast paced product iterations
 
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
 
Grokking Engineering - Data Analytics Infrastructure at Viki - Huy Nguyen
Grokking Engineering - Data Analytics Infrastructure at Viki - Huy NguyenGrokking Engineering - Data Analytics Infrastructure at Viki - Huy Nguyen
Grokking Engineering - Data Analytics Infrastructure at Viki - Huy Nguyen
 
Iot 1906 - approaches for building applications with the IBM IoT cloud
Iot 1906 - approaches for building applications with the IBM IoT cloudIot 1906 - approaches for building applications with the IBM IoT cloud
Iot 1906 - approaches for building applications with the IBM IoT cloud
 

Plus de MongoDB

Plus de MongoDB (20)

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 .local Paris 2020: Adéo @MongoDB : MongoDB Atlas & Leroy Merlin : et ...
MongoDB .local Paris 2020: Adéo @MongoDB : MongoDB Atlas & Leroy Merlin : et ...MongoDB .local Paris 2020: Adéo @MongoDB : MongoDB Atlas & Leroy Merlin : et ...
MongoDB .local Paris 2020: Adéo @MongoDB : MongoDB Atlas & Leroy Merlin : et ...
 

Dernier

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
 

Dernier (20)

TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdf
 
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
 
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
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
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
 
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu SubbuApidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
 
A Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source MilvusA Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source Milvus
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
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...
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 

Building Your First App with MongoDB Stitch

  • 2. #MDBlocal When building, you need to… 1. Safely and easily access data 2. Integrate with key services 3. Scalably serve requests
  • 3. #MDBlocal MongoDB Query Language + Native DriversIntegrated Rules Functions3rd Party Services Native SDKs (JavaScript, Android, iOS) Rest-like API
  • 4. #MDBlocal Integrated services and Functions for complex, connection logic Native SDKs for Android, JS, and iOS clients Direct Database Access
  • 5. #MDBlocal How requests work… 1. Application request is made 1
  • 6. #MDBlocal How requests work… 1. Application request is made 2. Stitch parses and applies rules 2
  • 7. #MDBlocal How requests work… 1. Application request is made 2. Stitch parses and applies rules 3. Stitch orchestrates DB + Services 3 3
  • 8. #MDBlocal How requests work… 1. Application request is made 2. Stitch parses and applies rules 3. Stitch orchestrates DB + Services 4. Stitch aggregates and applies rules 4
  • 9. #MDBlocal How requests work… 1. Application request is made 2. Stitch parses and applies rules 3. Stitch orchestrates DB + Services 4. Stitch aggregates and applies rules 5. Client receives results 5
  • 10. const stitch = require('mongodb-stitch'); let client, mongodb, coll, users; stitch.StitchClientFactory .create('APP-ID') .then(stitchClient => { client = stitchClient; mongodb = client.service('mongodb', 'mongodb-atlas'); coll = mongodb.db('Demo').collection(’Users'); }); MongoDB Services Functions Stitch Concepts
  • 11. client.login().then(() => { // You can use client.authenticate() to access other auth providers client.authenticate('providerType', {options}) // Providers include: // - Anonymous // - Email/Password // - Facebook // - Google // - API Keys // - Custom (signed JWT) MongoDB Services Functions Stitch Concepts
  • 12. client.login().then(() => { coll.find({'city': 'Seattle'}).execute().then(docs => { users = docs; }); }); // Or execute almost any find/aggregate command coll.find({'city': 'Seattle'}) .aggregate([…]) .count(…) .deleteMany(…) .deleteOne(…) .insertMany(…) .insertOne(…) .updateMany(…) .updateOne(…) MongoDB Services Functions Stitch Concepts
  • 13. const twilioService = client.service('twilio', 'twilioService') twilioService.send('+120155555553', '+12018675309', message) const sesService = client.service('ses', 'sesService') sesService.send(fromEmail, toEmail, message) const s3Service = client.service('s3', 's3Service') s3Service.put(bucket, key, acl, contentType) MongoDB Services Functions Stitch Concepts
  • 14. #MDBlocal • Scalable, hosted JavaScript functions • Written using ECMAScript 5 • Easily incorporate application context - context.values - context.services - context.user - context.request - context.functions - context.utils Stitch Functions
  • 16. client.executeFunction('sendWeather', 'Seattle'); MongoDB Services Functions Stitch Concepts //Function sendweather exports = function(city) { var mongodb = context.services.get("mongodb-atlas"); var UserColl = mongodb.db("StitchDemo").collection("Users"); var twilio = context.services.get("twilio"); var weather = context.services.get("weatherAPI"); var users = UserColl.find({"city": city}); var forecast = weather.get({context.values.get("weatherURL") + city}); var statuses = []; for(var i in users){ statuses.push(twilio.send(context.values.get("twilioPhone")), users[i].Phone, forecast); } return statuses; }
  • 17. #MDBlocal • Control DB/Service/Function access • Fine-grained data access controls • Define with simple JSON or link to functions • Associate with user profile, MDB Data, or external info Declarative Access Controls
  • 18. #MDBlocal Atlas Customer Account Data { "owner_id": … , "balance": … , "transactions": {…}, "user_profile": {….} }Bank Teller Analys t Custome r Roles,Permissions,andSecurity Application Reporting Data Mart User Profile: “I need to access my account” Role Based: “I need to lookup transactions without seeing personal information” Aggregate Only: “I need to understand the bank’s total cash flow”
  • 19. #MDBlocal Bank Teller Analys t Custome r Atlas Customer Account Data { "owner_id": … , "balance": … , "transactions": {…}, "user_profile": {….} } Stitch user_profile (Read Rule) {”owner_id": ”%%user.id"} balance/transactions (Read Rules) { ”%or": [ {”owner_id": ”%%user.id"}, {"%%true": { "%function": { "name": ”isTeller", "args": [] } ] } { "user_id": … , "balance": … , "transactions": {…}, "user_profile": {….} }
  • 20. #MDBlocal Stitch user_profile (Read Rule) {”owner_id": ”%%user.id"} balance/transactions (Read Rules) { ”%or": [ {”owner_id": ”%%user.id"}, {"%%true": { "%function": { "name": ”isTeller", "args": [] } ] } Bank Teller Analys t Custome r Atlas Customer Account Data { "owner_id": … , "balance": … , "transactions": {…}, "user_profile": {….} } { "user_id": … , "balance": … , "transactions": {…} }
  • 21. #MDBlocal Stitch user_profile (Read Rule) {”owner_id": ”%%user.id"} balance/transactions (Read Rules) { ”%or": [ {”owner_id": ”%%user.id"}, {"%%true": { "%pipeline": { "name": "CheckAuth", "args": { "AuthType": "server", "UserAuth": "%%user.type"} } ] } Stitch user_profile (Read Rule) {”owner_id": ”%%user.id"} balance/transactions (Read Rules) { ”%or": [ {”owner_id": ”%%user.id"}, {"%%true": { "%function": { "name": ”isTeller", "args": [] } ] } Bank Teller Analys t Custome r {Aggregated Data} Stitch Function for Analysis { "%%true": { "%function": { "name": ”isAnalyst", "args": []} } Atlas Customer Account Data { "owner_id": … , "balance": … , "transactions": {…}, "user_profile": {….} }
  • 23. #MDBlocal Amazon S3 MongoDB Atlas twilio Amazon Rekognition 2FA Access Control with Stitch Secure IoT Client • Bi-directional communication • Secure com via API key auth • Device access to DB, functions and Services Complex, Scalable Backend • Deeply integrated services • Coordination logic via Functions • Security through Auth + Rules • Elastic scale
  • 24. #MDBlocal MongoDB Atlas Twilio Amazon Rekognition {key: “*”} capture_image() {match: Drew, Prob: 99.0%} {user: “Drew”, Ph#: 555-1212} {user: Drew, OTP: 135} {user: Drew, OTP: 135} Ph#: 555-1212 {Ph#: 555-1212, OTP: 135} {OTP: 135} {OTP: 135} Amazon S3 process: 1. User requests photo + SMS entry 2. Stitch asks ElectricImp for photo 3. EI takes photo, sends to Stitch 4. Stitch sends the photo to AWS S3 and Rekognition 5. Rekognition sends image analysis 6. Stitch queries Atlas for User 7. Stitch generates an entry code, writes log, sends text via Twilio 8. User enters code with key pad, ElectricImp sends to Stitch 9. Stitch checks code against logs 10. If the code is valid, the Stitch sends Electric Imp a message to unlock.
  • 26. #MDBlocal Add Features • Take your app to a new platform • Build a better permissions system or a separate admin portal • Add additional authentication providers Expose Data • Provide an API for safe, internal data access • Build more precise permissions system • Create a real-time dashboard with authentication and security built-in Integrate Services • Integrate with any service or API with minimal code • Consume/action on data in real time with webhooks • Communicate with data using text, e-mail, etc. Complete Backend • Build faster without boilerplate code • Easily span multiple platforms • Scale at a moments notice • Single, simplified point to manage infrastructure/logic
  • 27. #MDBlocal • $1 per GB of data transferred from Stitch to client/service • 25 GB Free per month • Data transfer to Atlas is free Pricing
  • 28. #MDBlocal xx Everywher e 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?
  • 29. #MDBlocal • Check out our hands-on lab: 12:50PM in the Sound Room • 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?