Faites évoluer votre accès aux données
avec MongoDB Stitch
Emmanuel Macé, Manager Solutions Architect, MongoDB
An Introduction to Stitch
Agenda {
intro : “MongoDB Stitch”,
pattern : “Serverless Platform”,
topic : {
name : ”Stitch Overview”,
Duration : 10,
stitch : true,
},
demo : {
name : “Stitch in action”,
stitch :{
Twilio: true,
HTTPService : true,
Trigger : true,
Function : true,
},
}
Traditional Applications….
• Contain many, separate layers
• Each layer is separate code, infrastructure
• Connecting/Maintaining layers is lots of work
Building an Application without Stitch
Presentation
UI Components
UI Process Components
Business
Business
Workflow
Business
Components
Business
Entities
Application Facade
Data
Data Access
Components
Data Helper
Utilities
Server Agents
Data Sources Services
Users External Systems
Service
Interface
CrossCutting
Security
OperationalManagement
Communication
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
Presentation
UI Components
UI Process Components
Business
Business
Workflow
Business
Components
Business
Entities
Application Facade
Data
Data Access
Components
Data Helper
Utilities
Server Agents
Data Sources Services
Users External Systems
#doingmorewithless
Stitch Components
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
(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.
Demo Workflow
{Insert} {Update}
06 44 60 28 83
Query
Anywhere
Triggers FunctionsExternal Service
exports = function(payload) {
const mongodb = context.services.get("mongodb-atlas");
const movies = mongodb.db("stitch").collection("movies");
movies.insertOne(
{
"Title":payload.Body.trim(),
"Owner": payload.From
}
)
.then(result => {
response.setBody(result.insertedId);
});
};
exports = function(changeEvent) {
var docId = changeEvent.documentKey._id;
var title =
encodeURIComponent(changeEvent.fullDocument.Title.trim());
var movies = context.services.get("mongodb-
atlas").db("stitch").collection("movies");
var imdb_url = "http://www.omdbapi.com/?apikey=4b4b188d&t=" +
title;
const http = context.services.get("IMDB");
return http
.get({ url: imdb_url })
.then(resp => {
var doc = EJSON.parse(resp.body.text());
movies.updateOne({"_id":docId}, doc);
});
};
HTTP Service Data Enrichment Function
exports = function(payload) {
const mongodb = context.services.get("mongodb-atlas");
const movies = mongodb.db("stitch").collection("movies");
movies.insertOne(
{
"Title":payload.Body.trim(),
"Owner": payload.From
}
)
.then(result => {
response.setBody(result.insertedId);
});
};
exports = function(changeEvent) {
var docId = changeEvent.documentKey._id;
var title =
encodeURIComponent(changeEvent.fullDocument.Title.trim());
var movies = context.services.get("mongodb-
atlas").db("stitch").collection("movies");
var imdb_url = "http://www.omdbapi.com/?apikey=4b4b188d&t=" +
title;
const http = context.services.get("IMDB");
return http
.get({ url: imdb_url })
.then(resp => {
var doc = EJSON.parse(resp.body.text());
movies.updateOne({"_id":docId}, doc);
});
};
HTTP Service Data Enrichment Function

Faites évoluer votre accès aux données avec MongoDB Stitch

  • 2.
    Faites évoluer votreaccès aux données avec MongoDB Stitch Emmanuel Macé, Manager Solutions Architect, MongoDB An Introduction to Stitch
  • 3.
    Agenda { intro :“MongoDB Stitch”, pattern : “Serverless Platform”, topic : { name : ”Stitch Overview”, Duration : 10, stitch : true, }, demo : { name : “Stitch in action”, stitch :{ Twilio: true, HTTPService : true, Trigger : true, Function : true, }, }
  • 4.
    Traditional Applications…. • Containmany, separate layers • Each layer is separate code, infrastructure • Connecting/Maintaining layers is lots of work Building an Application without Stitch Presentation UI Components UI Process Components Business Business Workflow Business Components Business Entities Application Facade Data Data Access Components Data Helper Utilities Server Agents Data Sources Services Users External Systems Service Interface CrossCutting Security OperationalManagement Communication
  • 5.
    Traditional Applications…. • Containmany, 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 Presentation UI Components UI Process Components Business Business Workflow Business Components Business Entities Application Facade Data Data Access Components Data Helper Utilities Server Agents Data Sources Services Users External Systems #doingmorewithless
  • 6.
    Stitch Components QueryAnywhere Brings MongoDB'srich 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 (Beta)
  • 7.
    Apps with MongoDBStitch 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.
  • 8.
    Demo Workflow {Insert} {Update} 0644 60 28 83 Query Anywhere Triggers FunctionsExternal Service
  • 9.
    exports = function(payload){ const mongodb = context.services.get("mongodb-atlas"); const movies = mongodb.db("stitch").collection("movies"); movies.insertOne( { "Title":payload.Body.trim(), "Owner": payload.From } ) .then(result => { response.setBody(result.insertedId); }); }; exports = function(changeEvent) { var docId = changeEvent.documentKey._id; var title = encodeURIComponent(changeEvent.fullDocument.Title.trim()); var movies = context.services.get("mongodb- atlas").db("stitch").collection("movies"); var imdb_url = "http://www.omdbapi.com/?apikey=4b4b188d&t=" + title; const http = context.services.get("IMDB"); return http .get({ url: imdb_url }) .then(resp => { var doc = EJSON.parse(resp.body.text()); movies.updateOne({"_id":docId}, doc); }); }; HTTP Service Data Enrichment Function
  • 10.
    exports = function(payload){ const mongodb = context.services.get("mongodb-atlas"); const movies = mongodb.db("stitch").collection("movies"); movies.insertOne( { "Title":payload.Body.trim(), "Owner": payload.From } ) .then(result => { response.setBody(result.insertedId); }); }; exports = function(changeEvent) { var docId = changeEvent.documentKey._id; var title = encodeURIComponent(changeEvent.fullDocument.Title.trim()); var movies = context.services.get("mongodb- atlas").db("stitch").collection("movies"); var imdb_url = "http://www.omdbapi.com/?apikey=4b4b188d&t=" + title; const http = context.services.get("IMDB"); return http .get({ url: imdb_url }) .then(resp => { var doc = EJSON.parse(resp.body.text()); movies.updateOne({"_id":docId}, doc); }); }; HTTP Service Data Enrichment Function