SlideShare una empresa de Scribd logo
1 de 60
Evolving your
data Access with
MongoDB Stitch
Drew DiPalma – Sr. Product Manager, Cloud
Rendering
Data
App ServerDatabase IoT DevicesPhone
Browser
State
Logic
CRUD Email
QueuesAccess Control
Payments
State
Sign On
Service
Coordination
Images
Applications are evolving
Rendering
Data
App ServerDatabase IoT DevicesPhone
Browser
State
Logic
CRUD Email
QueuesAccess Control
Payments
State
Sign On
Service
Coordination
Images
Applications are evolving
Rendering
Data
Database IoT DevicesPhone
Browser
State
Logic
CRUD
Email
Queues
Access Control
Payments
State
Sign On
Service
Coordination
Images
Applications are evolving
How is development evolving?
Application are living in more locations:
• 48% of apps have backends deployed to a public cloud
• 58% of apps are now developed for multiple platforms
More is expected of development:
• 64% of developers identified as full-stack (2017)
Too much time is spent on maintaining:
• 41% of time spent maintaining
• 39% on new projects
Deploy and scale your application seamlessly
Write straightforward, standard code
Build simple, secure integrations
Traditional Applications….
• Contain many, separate layers
• Each layer is separate code, infrastructure
• Connecting/Maintaining layers is lots of work
Building an Application with Stitch
Traditional Applications….
• Contain many, separate layers
• Each layer is separate code, infrastructure
• Connecting/Maintaining layers is lots of work
Building an Application with Stitch
Security
&
Auth
Integrations
Business Logic
Data Access
Traditional Applications….
• Contain many, separate layers
• Each layer is separate code, infrastructure
• Connecting/Maintaining layers is lots of work
Building an Application with Stitch
Building applications with Stitch....
• No infrastructure to scale/patch/manage
• Simplified service integrations
• Easy to configure security
• Hosted, serverless business logic
Stitch is comprised of 4 services –
QueryAnywhere
Brings MongoDB's rich
query language safely to
your application
Build full apps for iOS,
Android, Web, and IoT
Functions
Integrate microservices +
server-side logic + cloud
services
Power apps with Server-side
logic, or enable Data as a
Service with custom APIs.
Triggers
Real-time notifications let your
application functions react in
response to database changes
App responds immediately to
changes
Mobile Sync
Automatically synchronizes
data between documents
held locally in MongoDB
Mobile and your backend
database
(Coming Soon) (Beta)
Apps with MongoDB Stitch
Cloud Infrastructure
Access Rules & Service Integrations
Application Logic (Functions/Triggers)
MongoDB Atlas
Rapidly deploy, dynamically scale, and distribute
databases across regions and cloud providers
MongoDB Stitch
Serverless platform with integrated authentication,
access rules, functions, and service integrations.
Client Application or Service
Application Logic
Local Application DataMongoDB Mobile Local MongoDB optimized for devices
MongoDB Stitch SDKs
Native SDKs with integrated authentication, and
providing access to Stitch, Atlas, and integrated
Services.
Stitch QueryAnywhere
Authentication & Rules
MongoDB Query Language + Native DriversIntegrated Rules
Functions3rd Party Services
Native SDKs (JavaScript, Android, iOS)
Rest API
How Applications interact with Stitch –
Filters in Stitch
User
Filters in Stitch
User
db.collection.find()
(plus user info)
Filters in Stitch
User
db.collection.find()
(plus user info)
Filters contain an ApplyWhen and a
Query which is appended to a request
Filters in Stitch
User
{
"name": "userId",
"apply_when": {"%%true" : "%%true"},
"query": {"userid":"%%user.id"}
}
Filters contain an ApplyWhen and a
Query which is appended to a request
db.collection.find()
(plus user info)
Filters in Stitch
User
db.collection.find({userid: "%%user.id"})
{
"name": "userId",
"apply_when": {"%%true" : "%%true"},
"query": {"userid":"%%user.id"}
}
Filters contain an ApplyWhen and a
Query which is appended to a request
Filters in Stitch
User
db.collection.find({userid: "5b2..."})
{
"name": "userId",
"apply_when": {"%%true" : "%%true"},
"query": {"userid":"%%user.id"}
}
Filters contain an ApplyWhen and a
Query which is appended to a request
Filters in Stitch
User
db.collection.find({userid: "5b2..."})
{
"name": "userId",
"apply_when": {"%%true" : "%%true"},
"query": {"userid":"%%user.id"}
}
Filters contain an ApplyWhen and a
Query which is appended to a request
Filters in Stitch
User Results
{
"name": "userId",
"apply_when": {"%%true" : "%%true"},
"query": {"userid":"%%user.id"}
}
Filters contain an ApplyWhen and a
Query which is appended to a request
Filters in Stitch
User [{
userid: "5b2..."
data: …
isSecret: false
},{
userid: "5b2..."
data: …
isSecret: true
}]
[{
userid: "5b2..."
data: …
isSecret: false
},{
userid: "5b2..."
data: …
isSecret: true
}]
Roles are defined by Match statements,
evaluated per document, and assign a set of
Rules per document
User
Roles in Stitch
[{
userid: "5b2..."
data: …
isSecret: false
},{
userid: "5b2..."
data: …
isSecret: true
}]
Roles are defined by Match statements,
evaluated per document, and assign a set of
Rules per document
User
Roles in Stitch
Roles are defined by Match statements,
evaluated per document, and assign a set of
Rules per document
User
{name: "Not Secret Data",
apply_when: {"isSecret": false},
fields: {…}
}
Roles in Stitch
Roles are defined by Match statements,
evaluated per document, and assign a set of
Rules per document
User
{name: "Not Secret Data",
apply_when: {"isSecret": false},
fields: {…}
}
[{
userid: "5b2..."
data: …
isSecret: false
}]
Roles in Stitch
User
[{
userid: "5b2..."
data: …
isSecret: false
}]
Roles in Stitch
User
Rules in Stitch
"fields": {
"data": {"read": true}
},
"additional_fields": {
"read": false,
"write": false
}
Each Role has a set of matching Rules that
define read and write access at the field-level
[{
userid: "5b2..."
data: …
isSecret: false
}]
User
Rules in Stitch
"fields": {
"data": {"read": true}
},
"additional_fields": {
"read": false,
"write": false
}
Each Role has a set of matching Rules that
define read and write access at the field-level
User
Rules in Stitch Each Role has a set of matching Rules that
define read and write access at the field-level
[{
data: …
}]
User
Rules in Stitch Each Role has a set of matching Rules that
define read and write access at the field-level
[{
data: …
}]
{
"filters": [{
"name": "userId",
"apply_when": {"%%true" : "%%true"},
"query": {"userid":"%%user.id"}
}, … ],
"roles": [{
name: "Secret Data"
apply_when: {isSecret: false}
"fields": {
"data": {
"read": true
}
},
"additional_fields": {
"read": false,
"write": false
}}, … ],
"schema": {…}
}
Filters
Roles
Rules
Schema
Stitch Rules
schema: {
bsonType: "object",
required: ["userid", "data", "isSecret"],
properties: {
userid: {
bsonType: "objectid",
description: "The ID of the Stitch user"
},
data: {
bsonType: "string",
description: "must be a string and is not required"
},
isSecret: {
bsonType: "bool",
description: "True if the data is a secret"
}
additionalProperties: false
}
JSON Schema
schema: {
bsonType: "object",
required: ["userid", "data", "isSecret"],
properties: {
userid: {
bsonType: "objectid",
description: "The ID of the Stitch user"
},
data: {
bsonType: "string",
validate: {"%%true": {"%function": {
"name": "isValid",
"arguments": ["%%user", "%%this"]}}}
description: "must be a string and is not required"
},
isSecret: {
bsonType: "bool",
description: "True if the data is a secret"
}
[...]
Schema Validation
Stitch QueryAnywhere
Simple data access from your frontend
# M D B l o c a l
const stitchClient = stitch.initializeDefaultAppClient('myApp');
MongoDB Services Functions
Stitch Concepts
# M D B l o c a l
const stitchClient = stitch.initializeDefaultAppClient('myApp');
// Connect to a MongoDB Atlas database
const coll = stitchClient
.getServiceClient(RemoteMongoClient.factory, 'mongodb-atlas')
.db('Demo')
.collection('Users');
MongoDB Services Functions
Stitch Concepts
# M D B l o c a lMongoDB Services Functions
Stitch Concepts
# M D B l o c a l
// Authenticate, then add and retrieve documents.
stitchClient.auth.loginWithCredential(
MongoDB Services Functions
Stitch Concepts
# M D B l o c a l
// Authenticate, then add and retrieve documents.
stitchClient.auth.loginWithCredential(
// You can use loginWithCredential() to access any auth provider
// Providers include:
// - Anonymous
// - Email/Password
// - Facebook
// - Google
// - API Keys
// - Custom (signed JWT)
MongoDB Services Functions
Stitch Concepts
# M D B l o c a l
// Authenticate, then query the database
stitchClient.auth.loginWithCredential(new AnonymousCredential())
.then(() =>
coll.find().asArray()
).then(users =>
...
);
MongoDB Services Functions
Stitch Concepts
# M D B l o c a l
// Authenticate, then query the database
stitchClient.auth.loginWithCredential(new AnonymousCredential())
.then(() =>
coll.find().asArray()
).then(users =>
...
);
// Or execute almost any CRUD/Aggregate command
coll.find({})
.aggregate([…])
.count(…)
.deleteMany(…) / .deleteOne(…)
.insertMany(…) / .insertOne(…)
.updateMany(…) / .updateOne(…)
MongoDB Services Functions
Stitch Concepts
# M D B l o c a lMongoDB Services Functions
Stitch Concepts
# M D B l o c a l
const twilio = stitchClient.getServiceClient(
TwilioServiceClient.factory, 'myTwilioService');
MongoDB Services Functions
Stitch Concepts
# M D B l o c a l
const twilio = stitchClient.getServiceClient(
TwilioServiceClient.factory, 'myTwilioService');
twilio.sendMessage(toPhone, fromPhone, 'A message from Stitch!')
.then(() => console.log('success!’));
MongoDB Services Functions
Stitch Concepts
# M D B l o c a lMongoDB Services Functions
Stitch Concepts
# M D B l o c a l
const aws = stitchClient.getServiceClient(
AwsServiceClient.factory, 'awsService');
MongoDB Services Functions
Stitch Concepts
# M D B l o c a l
const aws = stitchClient.getServiceClient(
AwsServiceClient.factory, 'awsService');
const request = new AwsRequest.Builder()
.withService('s3')
.withAction('PutObject')
.withArgs(args)
.build();
MongoDB Services Functions
Stitch Concepts
# M D B l o c a l
const aws = stitchClient.getServiceClient(
AwsServiceClient.factory, 'awsService');
const request = new AwsRequest.Builder()
.withService('s3')
.withAction('PutObject')
.withArgs(args)
.build();
aws.execute(request).then(() => console.log('success!'));
MongoDB Services Functions
Stitch Concepts
Stitch Functions
Add more complex logic to your application
Stitch Functions
Stitch is a collection of servers that
process application requests
Requests:
• Single actions for Database or Services
• Or executing a Stitch Function
• Integrated with Stitch’s rules
Functions:
• Scalable, hosted JavaScript (ES6) Functions
• Optimized for low-latency application requests
• Integrated with application context
• User, Request, Services, Values, etc.
Stitch Functions
addtoCart calcStats
… sendMail
Application
(Stitch SDK)
MongoDB
# M D B l o c a l
client.callFunction('sendWeather', ['London']);
MongoDB Services Functions
Stitch Concepts
# M D B l o c a l
client.callFunction('sendWeather', ['London']);
MongoDB Services Functions
Stitch Concepts
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 = [];
return Promise.all(users, forecast).then(data => {
for(var i in data.users){
statuses.push(twilio.send(context.values.get("twilio")), data.users[i].Phone, data.forecast);
}
return Promise.all(statuses);
});
}
# M D B l o c a l
client.callFunction('sendWeather', ['London']);
MongoDB Services Functions
Stitch Concepts
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 = [];
return Promise.all(users, forecast).then(data => {
for(var i in data.users){
statuses.push(twilio.send(context.values.get("twilio")), data.users[i].Phone, data.forecast);
}
return Promise.all(statuses);
});
}
# M D B l o c a l
client.callFunction('sendWeather', ['London']);
MongoDB Services Functions
Stitch Concepts
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 = [];
return Promise.all(users, forecast).then(data => {
for(var i in data.users){
statuses.push(twilio.send(context.values.get("twilio")), data.users[i].Phone, data.forecast);
}
return Promise.all(statuses);
});
}
# M D B l o c a l
client.callFunction('sendWeather', ['London']);
MongoDB Services Functions
Stitch Concepts
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 = [];
return Promise.all(users, forecast).then(data => {
for(var i in data.users){
statuses.push(twilio.send(context.values.get("twilio")), data.users[i].Phone, data.forecast);
}
return Promise.all(statuses);
});
}
# M D B l o c a l
client.callFunction('sendWeather', ['London']);
MongoDB Services Functions
Stitch Concepts
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 = [];
return Promise.all(users, forecast).then(data => {
for(var i in data.users){
statuses.push(twilio.send(context.values.get("twilio")), data.users[i].Phone, data.forecast);
}
return Promise.all(statuses);
});
}
Developing with Stitch
Create and deploy code
• Import/Export your application
configuration
• Develop with Stitch locally
• Add to repositories for versioning
and collaboration
• Easily move code between
environments
• Use structure from existing apps to
create something new
Stitch CLI & Import/Export
yourStitchApp/
├── stitch.json
├── auth_providers/
│ └── <provider name>.json
├── functions/
│ └── <function name>/
│ ├── config.json
│ └── source.js
├── services/
│ └── <service name>/
│ ├── config.json
│ ├── incoming_webhooks/
│ │ ├── config.json
│ │ └── source.js
│ └── rules/
│ └── <rule name>.json
| ...
Simple & Cheap Consumption Pricing
• Streamlined with Database (MongoDB Atlas)
Data Transfer
• $.5/GB Data Downloaded
• 25 GB Data free/month
• Transfer to Atlas is free
Compute
• $0.000025 per GB-s for Compute
• Runtime - Length of request in ms
• Memory - Max memory used in 10MB blocks
• First 1,000,000 functions or 100,000GB-s free
Pricing
• Check out another talk on Stitch –
• MongoDB Mobile: Bringing the Power of MongoDB to Your Device – 2:50pm – 3:30pm
• Ch-Ch-Ch-Ch-Changes: Taking Your Stitch Application to the Next Level With Triggers – 4:45pm - 5:30pm
• Get started with 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 next?

Más contenido relacionado

La actualidad más candente

Create a Uniform Login Experience with a Centralized Cloud Authentication Sys...
Create a Uniform Login Experience with a Centralized Cloud Authentication Sys...Create a Uniform Login Experience with a Centralized Cloud Authentication Sys...
Create a Uniform Login Experience with a Centralized Cloud Authentication Sys...
Xamarin
 
Mixing OAuth 2.0, Jersey and Guice to Build an Ecosystem of Apps - JavaOne...
Mixing OAuth 2.0, Jersey and Guice to Build an Ecosystem of Apps - JavaOne...Mixing OAuth 2.0, Jersey and Guice to Build an Ecosystem of Apps - JavaOne...
Mixing OAuth 2.0, Jersey and Guice to Build an Ecosystem of Apps - JavaOne...
Hermann Burgmeier
 
Flex3 data binding
Flex3 data bindingFlex3 data binding
Flex3 data binding
guestdf3003
 

La actualidad más candente (20)

OReilly SACON2018 - Events on the outside, on the inside, and at the core
OReilly SACON2018 - Events on the outside, on the inside, and at the coreOReilly SACON2018 - Events on the outside, on the inside, and at the core
OReilly SACON2018 - Events on the outside, on the inside, and at the core
 
Create a Uniform Login Experience with a Centralized Cloud Authentication Sys...
Create a Uniform Login Experience with a Centralized Cloud Authentication Sys...Create a Uniform Login Experience with a Centralized Cloud Authentication Sys...
Create a Uniform Login Experience with a Centralized Cloud Authentication Sys...
 
Mixing OAuth 2.0, Jersey and Guice to Build an Ecosystem of Apps - JavaOne...
Mixing OAuth 2.0, Jersey and Guice to Build an Ecosystem of Apps - JavaOne...Mixing OAuth 2.0, Jersey and Guice to Build an Ecosystem of Apps - JavaOne...
Mixing OAuth 2.0, Jersey and Guice to Build an Ecosystem of Apps - JavaOne...
 
Exam 70-488 Developing Microsoft SharePoint Server 2013 Core Solutions Learni...
Exam 70-488 Developing Microsoft SharePoint Server 2013 Core Solutions Learni...Exam 70-488 Developing Microsoft SharePoint Server 2013 Core Solutions Learni...
Exam 70-488 Developing Microsoft SharePoint Server 2013 Core Solutions Learni...
 
Net course content
Net course contentNet course content
Net course content
 
Handling Eventual Consistency in JVM Microservices with Event Sourcing (javao...
Handling Eventual Consistency in JVM Microservices with Event Sourcing (javao...Handling Eventual Consistency in JVM Microservices with Event Sourcing (javao...
Handling Eventual Consistency in JVM Microservices with Event Sourcing (javao...
 
Flex3 data binding
Flex3 data bindingFlex3 data binding
Flex3 data binding
 
API
APIAPI
API
 
Spring Framework-II
Spring Framework-IISpring Framework-II
Spring Framework-II
 
Jquery
JqueryJquery
Jquery
 
ASP.NET Lecture 4
ASP.NET Lecture 4ASP.NET Lecture 4
ASP.NET Lecture 4
 
Understanding AngularJS HTML5 DataServices
Understanding AngularJS HTML5 DataServicesUnderstanding AngularJS HTML5 DataServices
Understanding AngularJS HTML5 DataServices
 
MongoDB Stitch Tutorial
MongoDB Stitch TutorialMongoDB Stitch Tutorial
MongoDB Stitch Tutorial
 
CIS13: How to Build a Federated Identity Service on Identity and Context Virt...
CIS13: How to Build a Federated Identity Service on Identity and Context Virt...CIS13: How to Build a Federated Identity Service on Identity and Context Virt...
CIS13: How to Build a Federated Identity Service on Identity and Context Virt...
 
CIS13: Deploying an Identity Provider in a Complex, Federated and Siloed World
CIS13: Deploying an Identity Provider in a Complex, Federated and Siloed WorldCIS13: Deploying an Identity Provider in a Complex, Federated and Siloed World
CIS13: Deploying an Identity Provider in a Complex, Federated and Siloed World
 
Spring Framework - III
Spring Framework - IIISpring Framework - III
Spring Framework - III
 
Dependency injection Drupal Camp Wrocław 2014
Dependency injection Drupal Camp Wrocław 2014Dependency injection Drupal Camp Wrocław 2014
Dependency injection Drupal Camp Wrocław 2014
 
IRJET- Hosting NLP based Chatbot on AWS Cloud using Docker
IRJET-  	  Hosting NLP based Chatbot on AWS Cloud using DockerIRJET-  	  Hosting NLP based Chatbot on AWS Cloud using Docker
IRJET- Hosting NLP based Chatbot on AWS Cloud using Docker
 
Authentication through Claims-Based Authentication
Authentication through Claims-Based AuthenticationAuthentication through Claims-Based Authentication
Authentication through Claims-Based Authentication
 
Lecture 11. Microsoft mobile services
Lecture 11. Microsoft mobile servicesLecture 11. Microsoft mobile services
Lecture 11. Microsoft mobile services
 

Similar a Evolving your Data Access with MongoDB Stitch - Drew Di Palma

Evolving your Data Access with MongoDB Stitch
Evolving your Data Access with MongoDB StitchEvolving your Data Access with MongoDB Stitch
Evolving your Data Access with MongoDB Stitch
MongoDB
 
SH 1 - SES 8 - Stitch_Overview_TLV.pptx
SH 1 - SES 8 - Stitch_Overview_TLV.pptxSH 1 - SES 8 - Stitch_Overview_TLV.pptx
SH 1 - SES 8 - Stitch_Overview_TLV.pptx
MongoDB
 

Similar a Evolving your Data Access with MongoDB Stitch - Drew Di Palma (20)

MongoDB World 2018: Evolving your Data Access with MongoDB Stitch
MongoDB World 2018: Evolving your Data Access with MongoDB StitchMongoDB World 2018: Evolving your Data Access with MongoDB Stitch
MongoDB World 2018: Evolving your Data Access with MongoDB Stitch
 
Evolving your Data Access with MongoDB Stitch
Evolving your Data Access with MongoDB StitchEvolving your Data Access with MongoDB Stitch
Evolving your Data Access with MongoDB Stitch
 
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 Stich Overview
MongoDB Stich OverviewMongoDB Stich Overview
MongoDB Stich Overview
 
[MongoDB.local Bengaluru 2018] Introduction to MongoDB Stitch
[MongoDB.local Bengaluru 2018] Introduction to MongoDB Stitch[MongoDB.local Bengaluru 2018] Introduction to MongoDB Stitch
[MongoDB.local Bengaluru 2018] Introduction to MongoDB Stitch
 
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
 
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
 
MongoDB.local Berlin: App development in a Serverless World
MongoDB.local Berlin: App development in a Serverless WorldMongoDB.local Berlin: App development in a Serverless World
MongoDB.local Berlin: App development in a Serverless World
 
MongoDB Stitch Introduction
MongoDB Stitch IntroductionMongoDB Stitch Introduction
MongoDB Stitch Introduction
 
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
 
SH 1 - SES 8 - Stitch_Overview_TLV.pptx
SH 1 - SES 8 - Stitch_Overview_TLV.pptxSH 1 - SES 8 - Stitch_Overview_TLV.pptx
SH 1 - SES 8 - Stitch_Overview_TLV.pptx
 
MongoDB Stitch Introduction
MongoDB Stitch IntroductionMongoDB Stitch Introduction
MongoDB Stitch Introduction
 
Microsoft graph and power platform champ
Microsoft graph and power platform   champMicrosoft graph and power platform   champ
Microsoft graph and power platform champ
 
MongoDB World 2019: Securing Application Data from Day One
MongoDB World 2019: Securing Application Data from Day OneMongoDB World 2019: Securing Application Data from Day One
MongoDB World 2019: Securing Application Data from Day One
 
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...
 
Introducing Stitch
Introducing Stitch Introducing Stitch
Introducing Stitch
 
Build Your Mobile App Faster with AWS Mobile Services (Part 1 - AWS)
Build Your Mobile App Faster with AWS Mobile Services (Part 1 - AWS)Build Your Mobile App Faster with AWS Mobile Services (Part 1 - AWS)
Build Your Mobile App Faster with AWS Mobile Services (Part 1 - AWS)
 
Community call: Develop multi tenant apps with the Microsoft identity platform
Community call: Develop multi tenant apps with the Microsoft identity platformCommunity call: Develop multi tenant apps with the Microsoft identity platform
Community call: Develop multi tenant apps with the Microsoft identity platform
 
Ibm xamarin gtruty
Ibm xamarin gtrutyIbm xamarin gtruty
Ibm xamarin gtruty
 
Build high performing mobile apps, faster with AWS
Build high performing mobile apps, faster with AWSBuild high performing mobile apps, faster with AWS
Build high performing mobile apps, faster with AWS
 

Más de MongoDB

Más de 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...
 

Último

%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
masabamasaba
 
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
masabamasaba
 
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
masabamasaba
 

Último (20)

%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
 
WSO2Con2024 - Enabling Transactional System's Exponential Growth With Simplicity
WSO2Con2024 - Enabling Transactional System's Exponential Growth With SimplicityWSO2Con2024 - Enabling Transactional System's Exponential Growth With Simplicity
WSO2Con2024 - Enabling Transactional System's Exponential Growth With Simplicity
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
 
WSO2CON 2024 Slides - Open Source to SaaS
WSO2CON 2024 Slides - Open Source to SaaSWSO2CON 2024 Slides - Open Source to SaaS
WSO2CON 2024 Slides - Open Source to SaaS
 
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital TransformationWSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
 
%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg
%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg
%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg
 
WSO2CON2024 - It's time to go Platformless
WSO2CON2024 - It's time to go PlatformlessWSO2CON2024 - It's time to go Platformless
WSO2CON2024 - It's time to go Platformless
 
Architecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the pastArchitecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the past
 
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
 
WSO2CON 2024 - Freedom First—Unleashing Developer Potential with Open Source
WSO2CON 2024 - Freedom First—Unleashing Developer Potential with Open SourceWSO2CON 2024 - Freedom First—Unleashing Developer Potential with Open Source
WSO2CON 2024 - Freedom First—Unleashing Developer Potential with Open Source
 
WSO2CON 2024 - API Management Usage at La Poste and Its Impact on Business an...
WSO2CON 2024 - API Management Usage at La Poste and Its Impact on Business an...WSO2CON 2024 - API Management Usage at La Poste and Its Impact on Business an...
WSO2CON 2024 - API Management Usage at La Poste and Its Impact on Business an...
 
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...
 
%in Benoni+277-882-255-28 abortion pills for sale in Benoni
%in Benoni+277-882-255-28 abortion pills for sale in Benoni%in Benoni+277-882-255-28 abortion pills for sale in Benoni
%in Benoni+277-882-255-28 abortion pills for sale in Benoni
 
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
 
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
 
WSO2Con204 - Hard Rock Presentation - Keynote
WSO2Con204 - Hard Rock Presentation - KeynoteWSO2Con204 - Hard Rock Presentation - Keynote
WSO2Con204 - Hard Rock Presentation - Keynote
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learn
 
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
 
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
 
tonesoftg
tonesoftgtonesoftg
tonesoftg
 

Evolving your Data Access with MongoDB Stitch - Drew Di Palma

  • 1. Evolving your data Access with MongoDB Stitch Drew DiPalma – Sr. Product Manager, Cloud
  • 2. Rendering Data App ServerDatabase IoT DevicesPhone Browser State Logic CRUD Email QueuesAccess Control Payments State Sign On Service Coordination Images Applications are evolving
  • 3. Rendering Data App ServerDatabase IoT DevicesPhone Browser State Logic CRUD Email QueuesAccess Control Payments State Sign On Service Coordination Images Applications are evolving
  • 4. Rendering Data Database IoT DevicesPhone Browser State Logic CRUD Email Queues Access Control Payments State Sign On Service Coordination Images Applications are evolving
  • 5. How is development evolving? Application are living in more locations: • 48% of apps have backends deployed to a public cloud • 58% of apps are now developed for multiple platforms More is expected of development: • 64% of developers identified as full-stack (2017) Too much time is spent on maintaining: • 41% of time spent maintaining • 39% on new projects Deploy and scale your application seamlessly Write straightforward, standard code Build simple, secure integrations
  • 6. Traditional Applications…. • Contain many, separate layers • Each layer is separate code, infrastructure • Connecting/Maintaining layers is lots of work Building an Application with Stitch
  • 7. Traditional Applications…. • Contain many, separate layers • Each layer is separate code, infrastructure • Connecting/Maintaining layers is lots of work Building an Application with Stitch Security & Auth Integrations Business Logic Data Access
  • 8. Traditional Applications…. • Contain many, separate layers • Each layer is separate code, infrastructure • Connecting/Maintaining layers is lots of work Building an Application with Stitch Building applications with Stitch.... • No infrastructure to scale/patch/manage • Simplified service integrations • Easy to configure security • Hosted, serverless business logic
  • 9. Stitch is comprised of 4 services – QueryAnywhere Brings MongoDB's rich query language safely to your application Build full apps for iOS, Android, Web, and IoT Functions Integrate microservices + server-side logic + cloud services Power apps with Server-side logic, or enable Data as a Service with custom APIs. Triggers Real-time notifications let your application functions react in response to database changes App responds immediately to changes Mobile Sync Automatically synchronizes data between documents held locally in MongoDB Mobile and your backend database (Coming Soon) (Beta)
  • 10. Apps with MongoDB Stitch Cloud Infrastructure Access Rules & Service Integrations Application Logic (Functions/Triggers) MongoDB Atlas Rapidly deploy, dynamically scale, and distribute databases across regions and cloud providers MongoDB Stitch Serverless platform with integrated authentication, access rules, functions, and service integrations. Client Application or Service Application Logic Local Application DataMongoDB Mobile Local MongoDB optimized for devices MongoDB Stitch SDKs Native SDKs with integrated authentication, and providing access to Stitch, Atlas, and integrated Services.
  • 12. MongoDB Query Language + Native DriversIntegrated Rules Functions3rd Party Services Native SDKs (JavaScript, Android, iOS) Rest API How Applications interact with Stitch –
  • 15. Filters in Stitch User db.collection.find() (plus user info) Filters contain an ApplyWhen and a Query which is appended to a request
  • 16. Filters in Stitch User { "name": "userId", "apply_when": {"%%true" : "%%true"}, "query": {"userid":"%%user.id"} } Filters contain an ApplyWhen and a Query which is appended to a request db.collection.find() (plus user info)
  • 17. Filters in Stitch User db.collection.find({userid: "%%user.id"}) { "name": "userId", "apply_when": {"%%true" : "%%true"}, "query": {"userid":"%%user.id"} } Filters contain an ApplyWhen and a Query which is appended to a request
  • 18. Filters in Stitch User db.collection.find({userid: "5b2..."}) { "name": "userId", "apply_when": {"%%true" : "%%true"}, "query": {"userid":"%%user.id"} } Filters contain an ApplyWhen and a Query which is appended to a request
  • 19. Filters in Stitch User db.collection.find({userid: "5b2..."}) { "name": "userId", "apply_when": {"%%true" : "%%true"}, "query": {"userid":"%%user.id"} } Filters contain an ApplyWhen and a Query which is appended to a request
  • 20. Filters in Stitch User Results { "name": "userId", "apply_when": {"%%true" : "%%true"}, "query": {"userid":"%%user.id"} } Filters contain an ApplyWhen and a Query which is appended to a request
  • 21. Filters in Stitch User [{ userid: "5b2..." data: … isSecret: false },{ userid: "5b2..." data: … isSecret: true }]
  • 22. [{ userid: "5b2..." data: … isSecret: false },{ userid: "5b2..." data: … isSecret: true }] Roles are defined by Match statements, evaluated per document, and assign a set of Rules per document User Roles in Stitch
  • 23. [{ userid: "5b2..." data: … isSecret: false },{ userid: "5b2..." data: … isSecret: true }] Roles are defined by Match statements, evaluated per document, and assign a set of Rules per document User Roles in Stitch
  • 24. Roles are defined by Match statements, evaluated per document, and assign a set of Rules per document User {name: "Not Secret Data", apply_when: {"isSecret": false}, fields: {…} } Roles in Stitch
  • 25. Roles are defined by Match statements, evaluated per document, and assign a set of Rules per document User {name: "Not Secret Data", apply_when: {"isSecret": false}, fields: {…} } [{ userid: "5b2..." data: … isSecret: false }] Roles in Stitch
  • 27. User Rules in Stitch "fields": { "data": {"read": true} }, "additional_fields": { "read": false, "write": false } Each Role has a set of matching Rules that define read and write access at the field-level [{ userid: "5b2..." data: … isSecret: false }]
  • 28. User Rules in Stitch "fields": { "data": {"read": true} }, "additional_fields": { "read": false, "write": false } Each Role has a set of matching Rules that define read and write access at the field-level
  • 29. User Rules in Stitch Each Role has a set of matching Rules that define read and write access at the field-level [{ data: … }]
  • 30. User Rules in Stitch Each Role has a set of matching Rules that define read and write access at the field-level [{ data: … }]
  • 31. { "filters": [{ "name": "userId", "apply_when": {"%%true" : "%%true"}, "query": {"userid":"%%user.id"} }, … ], "roles": [{ name: "Secret Data" apply_when: {isSecret: false} "fields": { "data": { "read": true } }, "additional_fields": { "read": false, "write": false }}, … ], "schema": {…} } Filters Roles Rules Schema Stitch Rules
  • 32. schema: { bsonType: "object", required: ["userid", "data", "isSecret"], properties: { userid: { bsonType: "objectid", description: "The ID of the Stitch user" }, data: { bsonType: "string", description: "must be a string and is not required" }, isSecret: { bsonType: "bool", description: "True if the data is a secret" } additionalProperties: false } JSON Schema
  • 33. schema: { bsonType: "object", required: ["userid", "data", "isSecret"], properties: { userid: { bsonType: "objectid", description: "The ID of the Stitch user" }, data: { bsonType: "string", validate: {"%%true": {"%function": { "name": "isValid", "arguments": ["%%user", "%%this"]}}} description: "must be a string and is not required" }, isSecret: { bsonType: "bool", description: "True if the data is a secret" } [...] Schema Validation
  • 34. Stitch QueryAnywhere Simple data access from your frontend
  • 35. # M D B l o c a l const stitchClient = stitch.initializeDefaultAppClient('myApp'); MongoDB Services Functions Stitch Concepts
  • 36. # M D B l o c a l const stitchClient = stitch.initializeDefaultAppClient('myApp'); // Connect to a MongoDB Atlas database const coll = stitchClient .getServiceClient(RemoteMongoClient.factory, 'mongodb-atlas') .db('Demo') .collection('Users'); MongoDB Services Functions Stitch Concepts
  • 37. # M D B l o c a lMongoDB Services Functions Stitch Concepts
  • 38. # M D B l o c a l // Authenticate, then add and retrieve documents. stitchClient.auth.loginWithCredential( MongoDB Services Functions Stitch Concepts
  • 39. # M D B l o c a l // Authenticate, then add and retrieve documents. stitchClient.auth.loginWithCredential( // You can use loginWithCredential() to access any auth provider // Providers include: // - Anonymous // - Email/Password // - Facebook // - Google // - API Keys // - Custom (signed JWT) MongoDB Services Functions Stitch Concepts
  • 40. # M D B l o c a l // Authenticate, then query the database stitchClient.auth.loginWithCredential(new AnonymousCredential()) .then(() => coll.find().asArray() ).then(users => ... ); MongoDB Services Functions Stitch Concepts
  • 41. # M D B l o c a l // Authenticate, then query the database stitchClient.auth.loginWithCredential(new AnonymousCredential()) .then(() => coll.find().asArray() ).then(users => ... ); // Or execute almost any CRUD/Aggregate command coll.find({}) .aggregate([…]) .count(…) .deleteMany(…) / .deleteOne(…) .insertMany(…) / .insertOne(…) .updateMany(…) / .updateOne(…) MongoDB Services Functions Stitch Concepts
  • 42. # M D B l o c a lMongoDB Services Functions Stitch Concepts
  • 43. # M D B l o c a l const twilio = stitchClient.getServiceClient( TwilioServiceClient.factory, 'myTwilioService'); MongoDB Services Functions Stitch Concepts
  • 44. # M D B l o c a l const twilio = stitchClient.getServiceClient( TwilioServiceClient.factory, 'myTwilioService'); twilio.sendMessage(toPhone, fromPhone, 'A message from Stitch!') .then(() => console.log('success!’)); MongoDB Services Functions Stitch Concepts
  • 45. # M D B l o c a lMongoDB Services Functions Stitch Concepts
  • 46. # M D B l o c a l const aws = stitchClient.getServiceClient( AwsServiceClient.factory, 'awsService'); MongoDB Services Functions Stitch Concepts
  • 47. # M D B l o c a l const aws = stitchClient.getServiceClient( AwsServiceClient.factory, 'awsService'); const request = new AwsRequest.Builder() .withService('s3') .withAction('PutObject') .withArgs(args) .build(); MongoDB Services Functions Stitch Concepts
  • 48. # M D B l o c a l const aws = stitchClient.getServiceClient( AwsServiceClient.factory, 'awsService'); const request = new AwsRequest.Builder() .withService('s3') .withAction('PutObject') .withArgs(args) .build(); aws.execute(request).then(() => console.log('success!')); MongoDB Services Functions Stitch Concepts
  • 49. Stitch Functions Add more complex logic to your application
  • 50. Stitch Functions Stitch is a collection of servers that process application requests Requests: • Single actions for Database or Services • Or executing a Stitch Function • Integrated with Stitch’s rules Functions: • Scalable, hosted JavaScript (ES6) Functions • Optimized for low-latency application requests • Integrated with application context • User, Request, Services, Values, etc. Stitch Functions addtoCart calcStats … sendMail Application (Stitch SDK) MongoDB
  • 51. # M D B l o c a l client.callFunction('sendWeather', ['London']); MongoDB Services Functions Stitch Concepts
  • 52. # M D B l o c a l client.callFunction('sendWeather', ['London']); MongoDB Services Functions Stitch Concepts 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 = []; return Promise.all(users, forecast).then(data => { for(var i in data.users){ statuses.push(twilio.send(context.values.get("twilio")), data.users[i].Phone, data.forecast); } return Promise.all(statuses); }); }
  • 53. # M D B l o c a l client.callFunction('sendWeather', ['London']); MongoDB Services Functions Stitch Concepts 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 = []; return Promise.all(users, forecast).then(data => { for(var i in data.users){ statuses.push(twilio.send(context.values.get("twilio")), data.users[i].Phone, data.forecast); } return Promise.all(statuses); }); }
  • 54. # M D B l o c a l client.callFunction('sendWeather', ['London']); MongoDB Services Functions Stitch Concepts 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 = []; return Promise.all(users, forecast).then(data => { for(var i in data.users){ statuses.push(twilio.send(context.values.get("twilio")), data.users[i].Phone, data.forecast); } return Promise.all(statuses); }); }
  • 55. # M D B l o c a l client.callFunction('sendWeather', ['London']); MongoDB Services Functions Stitch Concepts 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 = []; return Promise.all(users, forecast).then(data => { for(var i in data.users){ statuses.push(twilio.send(context.values.get("twilio")), data.users[i].Phone, data.forecast); } return Promise.all(statuses); }); }
  • 56. # M D B l o c a l client.callFunction('sendWeather', ['London']); MongoDB Services Functions Stitch Concepts 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 = []; return Promise.all(users, forecast).then(data => { for(var i in data.users){ statuses.push(twilio.send(context.values.get("twilio")), data.users[i].Phone, data.forecast); } return Promise.all(statuses); }); }
  • 57. Developing with Stitch Create and deploy code
  • 58. • Import/Export your application configuration • Develop with Stitch locally • Add to repositories for versioning and collaboration • Easily move code between environments • Use structure from existing apps to create something new Stitch CLI & Import/Export yourStitchApp/ ├── stitch.json ├── auth_providers/ │ └── <provider name>.json ├── functions/ │ └── <function name>/ │ ├── config.json │ └── source.js ├── services/ │ └── <service name>/ │ ├── config.json │ ├── incoming_webhooks/ │ │ ├── config.json │ │ └── source.js │ └── rules/ │ └── <rule name>.json | ...
  • 59. Simple & Cheap Consumption Pricing • Streamlined with Database (MongoDB Atlas) Data Transfer • $.5/GB Data Downloaded • 25 GB Data free/month • Transfer to Atlas is free Compute • $0.000025 per GB-s for Compute • Runtime - Length of request in ms • Memory - Max memory used in 10MB blocks • First 1,000,000 functions or 100,000GB-s free Pricing
  • 60. • Check out another talk on Stitch – • MongoDB Mobile: Bringing the Power of MongoDB to Your Device – 2:50pm – 3:30pm • Ch-Ch-Ch-Ch-Changes: Taking Your Stitch Application to the Next Level With Triggers – 4:45pm - 5:30pm • Get started with 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 next?