SlideShare una empresa de Scribd logo
1 de 30
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T
在 MongoDB Cloud上構建無服務器化應用
唐建法
大中國區首席架構師
MongoDB
• S e s s i o n I D
2
MongoDB at a glance
Revenue ($MM)
$114.8
$166.0
$267.0
FY17 FY18 FY19
• Headquartered in New York, NY
• 1,200+ global employees
• 13,400+ customers in over 100 countries
• 60MM+ total downloads of MongoDB
Community Server
• >120% net ARR expansion rate
over each of the last sixteen quarters
Note: Fiscal year ending January 31
Massive adoption of MongoDB
MongoDB vs. NoSQL skills on LinkedIn Activity index on Stack Overflow
-
20,000
40,000
60,000
80,000
100,000
120,000
2012 2013 2014 2015 2016
MongoDB Redis Cassandra Hbase Other
Other
HBase
Cassandra
Redis
More developers want to work with MongoDB this year than any other database
– Stack Overflow Developer Survey (2018)
Source: 451 Research Source: StackOverkill
Neo4j
HBase
Cassandra
Redis
Leading modern general purpose database
Creative
Cloud Fintech
Real-Time
Travel Search
Mobile Drug
Applications
Mobile
Banking
Multi-Screen
TV
Internet of
Things Platform
Predictive
Messaging
Background Checks
as a Service
Order
Capture
Cryptocurrency
Platform
Logistics
Modernization
E-Commerce
System
Entry Decision
System
Social Security
Benefits Program
Mobile App for
Patient Data
Product
Catalog
Single View
of Patient
Genetic
Analysis
Online
Lending
Swap Equities
Management
E-Commerce
Personalization
E-Commerce
Platform
Marketing
Cloud
Video
Streaming
Log Metadata
Store
Social Media
Management
Website
Platform
Product
Catalog
Identity Theft
Protection
Mass Spectrometer
Instrumentation
Subscriber
QoS
Shopping
Cart
Gaming Platform
Online Tax Returns Real-Time Analytics
social
MongoDB Atlas
Managed MongoDB in the Cloud
Customers have two choices: Self-managed or DBaaS
Cloud Migration
or Cloud First
Self-Managed
Aka “Lift and Shift”
Database as
a service
Slow and complicated
No elasticity
Highly manual
Reduces ROI and agility
Self-service
Fully elastic
Consumption based
Reduces TCO and accelerates
time to value
Fork in
the road
7
The TRAP of doing it yourself
Provision servers
Configure high availability
Configure security
Configure and test backup
Install and configure monitoring
Ongoing upgrades and maintenance
Application development
Performance optimization
Manual work is the hallmark of low-
performing IT organizations.
Deployments
64%
more manual work
Config. Mgmt.
65%
more manual work
Testing
40%
more manual work
2017 State of DevOps Report, Puppet
MongoDB Atlas — Global Cloud Database
Self-service & elastic
Deploy, modify, and upgrade on demand with
best-in-class operational automation
Automated database maintenance
Database and infrastructure resources as code
Scale up, out, or down in a few clicks or API calls
Global & cloud-agnostic
Available in 60+ regions across globe
Global clusters for read/write anywhere
deployments and multi-region fault tolerance
Easy migrations with a consistent experience
across cloud providers
Enterprise-grade security & SLAs
Network isolation, VPC peering, end-to-end
encryption, and role-based access controls
Encryption key management, LDAP integration,
granular database auditing
SOC 2 / Privacy Shield / HIPAA
Guaranteed reliability with SLAs
Comprehensive monitoring
Deep visibility into 100+ KPIs with proactive
alerting
Real-time performance tracking and
Performance Advisor
APIs to integrate with monitoring dashboards
Managed backup
Point-in-time data recovery
Queryable backup snapshots
Consistent snapshots of sharded deployments
Cloud data mobility
Stitch: Serverless platform services
Simple, serverless functions for backend logic,
service integrations, and APIs
Database access from your frontend secured by
straightforward, field-level access rules
Database and authentication triggers to react to
changes in real time
MongoDB as a service on AWS
MongoDB Atlas is currently available in 16 AWS regions.
• us-east-1 (N. Virginia)
• us-east-2 (Ohio)
• us-west-2 (Oregon)
• us-west-1 (N. California)
• ca-central-1 (Canada)
• sa-east-1 (São Paulo)
Americas
• ap-east-1 (Hong Kong)
• ap-southeast-1 (Singapore)
• ap-southeast-2 (Sydney)
• ap-northeast-1 (Tokyo)
• ap-northeast-2 (Seoul)
• ap-south-1 (Mumbai)
Asia
• eu-west-1 (Dublin)
• eu-west-2 (London)
• eu-west-3 (Paris)
• eu-north-1 (Stockholm)
• eu-central-1 (Frankfurt)
Europe
Highly available by default
• A minimum of three data nodes per replica set/shard are
automatically deployed across zones for high availability
• If your primary node does go down for any reason, the self
healing recovery process in MongoDB Atlas will typically occur
in under 2 seconds
Application
Driver
Primary
Secondary
Secondary
Replication
Cross-region replication
• Ensure uptime in the unlikely event of a multi-
zone or total region outage
• Get improved performance for local reads by
geographically distributing read-only replica set
members that do not participate in the failover
process
• Available for Atlas deployments running on
dedicated instances in AWS
Fine-grained monitoring and alerts
● Monitoring and alerts provide full metrics on the
state of your cluster’s database and server
usage
● Automatic notifications when your database
operations or server usage reach defined
thresholds that affect your cluster's performance
● Combining our automated alerting with the
flexible scale-up-and-out options in MongoDB
Atlas, we can keep your database-supported
applications always performing as well as they
should
Continuous backup
• MongoDB Atlas continuously backs up your data, ensuring
your backups are typically just a few seconds behind the
operational system
• Point-in-time backup of replica sets and consistent, cluster-
wide snapshots of sharded clusters. With MongoDB Atlas,
you can easily and safely restore to precisely the moment
you need
• Compression and block-level deduplication technology
keeps your backup processes as efficient as possible
• Backups are securely stored in North America, Ireland,
Germany, United Kingdom, or Australia*. For more location
flexibility of your backup data, you can utilize MongoDB’s
mongodump / mongorestore tools
*Additional regions for continuous backup coming soon
Global Clusters
Distribute your fully automated database across multiple
geographically distributed zones made up of one or
more cloud regions
● Read and write locally to provide single-digit
millisecond latency for your distributed applications
● Ensure that data from certain geographies lives in
predefined zones
● Easily deploy using prebuilt zone templates or
build your own zones by choosing cloud regions in
an easy-to-use, visual interface
Server-less with Atlas Stitch
App Backend Infrastructure
Core Database Functionality
Storage
Service integrations, data access control
Code that moves the business forward
Managing OS, Scale, Security, Backups, etc.
Typical Technology Stack
App Backend Infrastructure
Core Database Functionality
Storage
Service integrations, data access control
Code that moves the business forward
Managing OS, Scale, Security, Backups, etc.
Utilize Database-as-a-Service
DBaaS
App Backend Infrastructure
Core Database Functionality
Storage
Service integrations, data access control
Code that moves the business forward
Managing OS, Scale, Security, Backups, etc.
Add Backend-as-a-Service
DBaaS
BaaS
App Backend Infrastructure
Core Database Functionality
Storage
Service integrations, data access control
Code that moves the business forward
Managing OS, Scale, Security, Backups, etc.
DBaaS
BaaS
You should focus here
And Focus Your Energy Where You Can Make a Difference
App Backend Infrastructure
Core Database Functionality
Storage
Service integrations, data access control
Code that moves the business forward
Managing OS, Scale, Security, Backups, etc.
And Focus Your Energy Where You Can Make a Difference
MongoDB
Atlas
MongoDB
Stitch
You should focus here
Fully managed
Elastic scale
Highly Available
Secure
在-MongoDB-Cloud-上構建無服務器化應用
Basic Blog Tutorial
<html>
<head>
</head>
<body>
<h3>This is a great blog post</h3>
<div id="content">
I like to write about technology because I want to get on
the front page of hacker news. (In a good way)
</div>
<hr>
<div id="comments"></div>
</body>
</html>
Nothing Special with the first step. Its basic HTML.
Save the file as BasicBlogDemo.html and double click the file, it
will open in your browser.
You can see the header, the content and the hard rule at the
bottom
Basic Blog Tutorial
<html>
<head>
<script src="https://s3.amazonaws.com/stitch-sdks/js/bundles/4.0.0/stitch.js"></script>
</head>
<body>
<h3>This is a great blog post</h3>
<div id="content">
I like to write about technology because I want to get on the front page of hacker news. (In a good way)
</div>
<hr>
<div id="comments"></div>
</body>
</html>
Ok, we just now included the stitch client browser SDK!
Basic Blog Tutorial
<html>
<head>
<script src="https://s3.amazonaws.com/stitch-sdks/js/bundles/4.0.0/stitch.js"></script>
<script>
// Initialize the App Client
const client = stitch.Stitch.initializeDefaultAppClient("<your-app-id>");
// Get a MongoDB Service Client
const mongodb = client.getServiceClient(stitch.RemoteMongoClient.factory,"mongodb-
atlas");
// Get a reference to the blog database
const db = mongodb.db("blog");
</script>
</head>
<body>
<h3>This is a great blog post</h3>
<div id="content">
I like to write about technology because I want to get on the front page of hacker news.
(In a good way)
</div>
<hr>
<div id="comments"></div>
</body>
</html>
Stitch client browser SDK
Stitch APP ID
Stitch Client
Connection
Stitch Database
We now have
everything we need to
connect to the Atlas
database instance for
our Application!
Basic Blog Tutorial<html>
<head>
<script src="https://s3.amazonaws.com/stitch-sdks/js/bundles/4.0.0/stitch.js"></script>
<script>
// Initialize the App Client
const client = stitch.Stitch.initializeDefaultAppClient("<your-app-id>");
// Get a MongoDB Service Client
const mongodb = client.getServiceClient(stitch.RemoteMongoClient.factory,"mongodb-
atlas");
// Get a reference to the blog database
const db = mongodb.db("blog");
function displayComments() {
db.collection('comments').find({}, {limit: 1000}).asArray()
.then(docs => {
const html = docs.map(c => "<div>" + c.comment +
"</div>").join("");
document.getElementById("comments").innerHTML = html;
});
}
</script>
</head>
<body>
<h3>This is a great blog post</h3>
<div id="content">
I like to write about technology because I want to get on the front page of hacker news.
(In a good way)
</div>
<hr>
<div id="comments"></div>
</body>
</html>
Our first real function!
Then we display them
in the comments div
as html for the user to
view
We specify the
comments collection
We find the
documents, and
specify a limit of 1,000
We Loop through the
array of documents
and store them in a
variable called html.
Basic Blog Tutorial<html>
<head>
<script src="https://s3.amazonaws.com/stitch-sdks/js/bundles/4.0.0/stitch.js"></script>
<script>
// Initialize the App Client
const client = stitch.Stitch.initializeDefaultAppClient("<your-app-id>");
// Get a MongoDB Service Client
const mongodb = client.getServiceClient(stitch.RemoteMongoClient.factory,"mongodb-
atlas");
// Get a reference to the blog database
const db = mongodb.db("blog");
function displayComments() {
db.collection('comments').find({}, {limit: 1000}).asArray()
.then(docs => {
const html = docs.map(c => "<div>" + c.comment +
"</div>").join("");
document.getElementById("comments").innerHTML = html;
});
}
function displayCommentsOnLoad() {
client.auth
.loginWithCredential(new stitch.AnonymousCredential())
.then(displayComments)
.catch(console.error);
}
</script>
</head>
<body>
<h3>This is a great blog post</h3>
<div id="content">
I like to write about technology because I want to get on the front page of hacker news.
(In a good way)
</div>
<hr>
<div id="comments"></div>
</body onload="displayCommentsOnLoad()">
</html>
Our next function logs
us into our database
We have connected to
the database and run
our first query! Check
the stitch console logs.
It calls the display
comments function
after logging in.
The function to
connect to the
database is called in
the body onload...
Save the changes and
refresh the browser.
Basic Blog Tutorial...
function addComment() {
const newComment = document.getElementById("new_comment");
console.log("add comment", client.auth.user.id)
db.collection("comments")
.insertOne({ owner_id : client.auth.user.id, comment: newComment.value })
.then(displayComments);
newComment.value = "";
}
function displayComments() {
db.collection('comments').find({}, {limit: 1000}).asArray()
.then(docs => {
const html = docs.map(c => "<div>" + c.comment +
"</div>").join("");
document.getElementById("comments").innerHTML = html;
});
}
...
</script>
</head>
<body>
<h3>This is a great blog post</h3>
<div id="content">
I like to write about technology because I want to get on the front page of hacker news.
(In a good way)
</div>
<hr>
Add comment:
<input id="new_comment"><BR>
<input type="submit" onClick="addComment()">
<hr>
<div id="comments"></div>
</body onload="displayCommentsOnLoad()">
</html>
Now we insert a
comment into our
Atlas database
through the stitch API,
and then retrieve it for
display
The value we insert is
obtained from an input
field added here.
The add comment
function is called from
the submit button
Our first stitch App is
complete!
Basic Blog Tutorial
Play with it, add more comments.
Add new fields, see what happens.
You are well on your way to being
able to start writing a new
application.
You now have a basic
understanding and are ready for
more.
The Server-less Architecture Accelerates Everything
Cloud Infrastructure
Services and APIs
Application Logic
MongoDB Atlas
Rapidly deploy, dynamically scale, and distribute
databases across regions and cloud providers
MongoDB Stitch
Serverless platform that allows developers to focus
on innovation rather than plumbing, services
orchestration, and boilerplate code
2-5x increase in productivity by leveraging the MongoDB Atlas + Stitch
Client Application or Service
Application Logic
DataData generated from your application is sent and retrieved
through the Stitch Client SDK
Thank you!
S U M M I T © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
唐建法
jianfa.tang@mongodb.com

Más contenido relacionado

La actualidad más candente

利用 Fargate - 無伺服器的容器環境建置高可用的系統
利用 Fargate - 無伺服器的容器環境建置高可用的系統利用 Fargate - 無伺服器的容器環境建置高可用的系統
利用 Fargate - 無伺服器的容器環境建置高可用的系統Amazon Web Services
 
Education : Digital transformation & AWS Foundations
Education : Digital transformation & AWS FoundationsEducation : Digital transformation & AWS Foundations
Education : Digital transformation & AWS FoundationsAmazon Web Services
 
Architecting security and governance across your AWS environment
Architecting security and governance across your AWS environmentArchitecting security and governance across your AWS environment
Architecting security and governance across your AWS environmentAmazon Web Services
 
Preparing Your Data for Cloud Analytics & AI/ML
Preparing Your Data for Cloud Analytics & AI/MLPreparing Your Data for Cloud Analytics & AI/ML
Preparing Your Data for Cloud Analytics & AI/MLAmazon Web Services
 
Databases-on-AWS-Purpose-built-databases,-the-right-tool-for-the-right-job
Databases-on-AWS-Purpose-built-databases,-the-right-tool-for-the-right-jobDatabases-on-AWS-Purpose-built-databases,-the-right-tool-for-the-right-job
Databases-on-AWS-Purpose-built-databases,-the-right-tool-for-the-right-jobAmazon Web Services
 
Leveraging Data Analytics in the Cloud to Support Data-Driven Decisions
Leveraging Data Analytics in the Cloud to Support Data-Driven DecisionsLeveraging Data Analytics in the Cloud to Support Data-Driven Decisions
Leveraging Data Analytics in the Cloud to Support Data-Driven DecisionsAmazon Web Services
 
Everything You Need to Know About Big Data: From Architectural Principles to ...
Everything You Need to Know About Big Data: From Architectural Principles to ...Everything You Need to Know About Big Data: From Architectural Principles to ...
Everything You Need to Know About Big Data: From Architectural Principles to ...Amazon Web Services
 
What's New in Amazon Aurora - ADB203 - Anaheim AWS Summit
What's New in Amazon Aurora - ADB203 - Anaheim AWS SummitWhat's New in Amazon Aurora - ADB203 - Anaheim AWS Summit
What's New in Amazon Aurora - ADB203 - Anaheim AWS SummitAmazon Web Services
 
Threat detection and mitigation at AWS - SEC301 - Santa Clara AWS Summit
Threat detection and mitigation at AWS - SEC301 - Santa Clara AWS SummitThreat detection and mitigation at AWS - SEC301 - Santa Clara AWS Summit
Threat detection and mitigation at AWS - SEC301 - Santa Clara AWS SummitAmazon Web Services
 
Stages of Adoption leading to Complete Migration
Stages of Adoption leading to Complete Migration	Stages of Adoption leading to Complete Migration
Stages of Adoption leading to Complete Migration Amazon Web Services
 
AWS Manufacturing Day Philadelphia-Boston-April 2019
AWS Manufacturing Day Philadelphia-Boston-April 2019AWS Manufacturing Day Philadelphia-Boston-April 2019
AWS Manufacturing Day Philadelphia-Boston-April 2019Amazon Web Services
 
An Amazonian approach to enterprise transformation
An Amazonian approach to enterprise transformationAn Amazonian approach to enterprise transformation
An Amazonian approach to enterprise transformationAmazon Web Services
 
Accelerating_Enterprise_Cloud_Transformation_By_Master_IT_Complexity
Accelerating_Enterprise_Cloud_Transformation_By_Master_IT_ComplexityAccelerating_Enterprise_Cloud_Transformation_By_Master_IT_Complexity
Accelerating_Enterprise_Cloud_Transformation_By_Master_IT_ComplexityAmazon Web Services
 
Database su AWS scegliere lo strumento giusto per il giusto obiettivo
Database su AWS scegliere lo strumento giusto per il giusto obiettivoDatabase su AWS scegliere lo strumento giusto per il giusto obiettivo
Database su AWS scegliere lo strumento giusto per il giusto obiettivoAmazon Web Services
 
SKL208 - Turbocharge your Business with AI and Machine Learning - Tel Aviv Su...
SKL208 - Turbocharge your Business with AI and Machine Learning - Tel Aviv Su...SKL208 - Turbocharge your Business with AI and Machine Learning - Tel Aviv Su...
SKL208 - Turbocharge your Business with AI and Machine Learning - Tel Aviv Su...Boaz Ziniman
 

La actualidad más candente (20)

利用 Fargate - 無伺服器的容器環境建置高可用的系統
利用 Fargate - 無伺服器的容器環境建置高可用的系統利用 Fargate - 無伺服器的容器環境建置高可用的系統
利用 Fargate - 無伺服器的容器環境建置高可用的系統
 
Education : Digital transformation & AWS Foundations
Education : Digital transformation & AWS FoundationsEducation : Digital transformation & AWS Foundations
Education : Digital transformation & AWS Foundations
 
Architecting security and governance across your AWS environment
Architecting security and governance across your AWS environmentArchitecting security and governance across your AWS environment
Architecting security and governance across your AWS environment
 
Preparing Your Data for Cloud Analytics & AI/ML
Preparing Your Data for Cloud Analytics & AI/MLPreparing Your Data for Cloud Analytics & AI/ML
Preparing Your Data for Cloud Analytics & AI/ML
 
Databases-on-AWS-Purpose-built-databases,-the-right-tool-for-the-right-job
Databases-on-AWS-Purpose-built-databases,-the-right-tool-for-the-right-jobDatabases-on-AWS-Purpose-built-databases,-the-right-tool-for-the-right-job
Databases-on-AWS-Purpose-built-databases,-the-right-tool-for-the-right-job
 
Leveraging Data Analytics in the Cloud to Support Data-Driven Decisions
Leveraging Data Analytics in the Cloud to Support Data-Driven DecisionsLeveraging Data Analytics in the Cloud to Support Data-Driven Decisions
Leveraging Data Analytics in the Cloud to Support Data-Driven Decisions
 
Analysing Data in Real-time
Analysing Data in Real-timeAnalysing Data in Real-time
Analysing Data in Real-time
 
Everything You Need to Know About Big Data: From Architectural Principles to ...
Everything You Need to Know About Big Data: From Architectural Principles to ...Everything You Need to Know About Big Data: From Architectural Principles to ...
Everything You Need to Know About Big Data: From Architectural Principles to ...
 
What's New in Amazon Aurora - ADB203 - Anaheim AWS Summit
What's New in Amazon Aurora - ADB203 - Anaheim AWS SummitWhat's New in Amazon Aurora - ADB203 - Anaheim AWS Summit
What's New in Amazon Aurora - ADB203 - Anaheim AWS Summit
 
Democratizing AI
Democratizing AIDemocratizing AI
Democratizing AI
 
Threat detection and mitigation at AWS - SEC301 - Santa Clara AWS Summit
Threat detection and mitigation at AWS - SEC301 - Santa Clara AWS SummitThreat detection and mitigation at AWS - SEC301 - Santa Clara AWS Summit
Threat detection and mitigation at AWS - SEC301 - Santa Clara AWS Summit
 
AWS Dev Day
AWS Dev DayAWS Dev Day
AWS Dev Day
 
Stages of Adoption leading to Complete Migration
Stages of Adoption leading to Complete Migration	Stages of Adoption leading to Complete Migration
Stages of Adoption leading to Complete Migration
 
AWS Manufacturing Day Philadelphia-Boston-April 2019
AWS Manufacturing Day Philadelphia-Boston-April 2019AWS Manufacturing Day Philadelphia-Boston-April 2019
AWS Manufacturing Day Philadelphia-Boston-April 2019
 
Open Data on AWS
Open Data on AWSOpen Data on AWS
Open Data on AWS
 
An Amazonian approach to enterprise transformation
An Amazonian approach to enterprise transformationAn Amazonian approach to enterprise transformation
An Amazonian approach to enterprise transformation
 
Accelerating_Enterprise_Cloud_Transformation_By_Master_IT_Complexity
Accelerating_Enterprise_Cloud_Transformation_By_Master_IT_ComplexityAccelerating_Enterprise_Cloud_Transformation_By_Master_IT_Complexity
Accelerating_Enterprise_Cloud_Transformation_By_Master_IT_Complexity
 
Database su AWS scegliere lo strumento giusto per il giusto obiettivo
Database su AWS scegliere lo strumento giusto per il giusto obiettivoDatabase su AWS scegliere lo strumento giusto per il giusto obiettivo
Database su AWS scegliere lo strumento giusto per il giusto obiettivo
 
Working with Open Data on AWS
Working with Open Data on AWSWorking with Open Data on AWS
Working with Open Data on AWS
 
SKL208 - Turbocharge your Business with AI and Machine Learning - Tel Aviv Su...
SKL208 - Turbocharge your Business with AI and Machine Learning - Tel Aviv Su...SKL208 - Turbocharge your Business with AI and Machine Learning - Tel Aviv Su...
SKL208 - Turbocharge your Business with AI and Machine Learning - Tel Aviv Su...
 

Similar a 在-MongoDB-Cloud-上構建無服務器化應用

How leading financial services organisations are winning with tech
How leading financial services organisations are winning with techHow leading financial services organisations are winning with tech
How leading financial services organisations are winning with techMongoDB
 
Discover MongoDB Atlas and MongoDB Stitch - DEM02-S - Mexico City AWS Summit
Discover MongoDB Atlas and MongoDB Stitch - DEM02-S - Mexico City AWS SummitDiscover MongoDB Atlas and MongoDB Stitch - DEM02-S - Mexico City AWS Summit
Discover MongoDB Atlas and MongoDB Stitch - DEM02-S - Mexico City AWS SummitAmazon Web Services
 
Cloud Data Strategy event London
Cloud Data Strategy event LondonCloud Data Strategy event London
Cloud Data Strategy event LondonMongoDB
 
La creación de una capa operacional con MongoDB
La creación de una capa operacional con MongoDBLa creación de una capa operacional con MongoDB
La creación de una capa operacional con MongoDBMongoDB
 
Data Streaming with Apache Kafka & MongoDB
Data Streaming with Apache Kafka & MongoDBData Streaming with Apache Kafka & MongoDB
Data Streaming with Apache Kafka & MongoDBconfluent
 
MongoDB .local Toronto 2019: MongoDB Atlas Jumpstart
MongoDB .local Toronto 2019: MongoDB Atlas JumpstartMongoDB .local Toronto 2019: MongoDB Atlas Jumpstart
MongoDB .local Toronto 2019: MongoDB Atlas JumpstartMongoDB
 
MongoDB - General Purpose Database
MongoDB - General Purpose DatabaseMongoDB - General Purpose Database
MongoDB - General Purpose DatabaseAshnikbiz
 
Accelerating a Path to Digital With a Cloud Data Strategy
Accelerating a Path to Digital With a Cloud Data StrategyAccelerating a Path to Digital With a Cloud Data Strategy
Accelerating a Path to Digital With a Cloud Data StrategyMongoDB
 
The New Normal - AWSome Day Zurich 112016
The New Normal - AWSome Day Zurich 112016The New Normal - AWSome Day Zurich 112016
The New Normal - AWSome Day Zurich 112016Amazon Web Services
 
What’s New in AWS Database Services
What’s New in AWS Database ServicesWhat’s New in AWS Database Services
What’s New in AWS Database ServicesAmazon Web Services
 
Mongo db multidc_webinar
Mongo db multidc_webinarMongo db multidc_webinar
Mongo db multidc_webinarMongoDB
 
Why NBC Universal Migrated to MongoDB Atlas
Why NBC Universal Migrated to MongoDB AtlasWhy NBC Universal Migrated to MongoDB Atlas
Why NBC Universal Migrated to MongoDB AtlasDatavail
 
Transforming a Large Mission-Critical E-Commerce Platform from a Relational A...
Transforming a Large Mission-Critical E-Commerce Platform from a Relational A...Transforming a Large Mission-Critical E-Commerce Platform from a Relational A...
Transforming a Large Mission-Critical E-Commerce Platform from a Relational A...MongoDB
 
Getting Started with Managed Database Services on AWS - AWS Summit Tel Aviv 2017
Getting Started with Managed Database Services on AWS - AWS Summit Tel Aviv 2017Getting Started with Managed Database Services on AWS - AWS Summit Tel Aviv 2017
Getting Started with Managed Database Services on AWS - AWS Summit Tel Aviv 2017Amazon Web Services
 
Solving enterprise challenges through scale out storage &amp; big compute final
Solving enterprise challenges through scale out storage &amp; big compute finalSolving enterprise challenges through scale out storage &amp; big compute final
Solving enterprise challenges through scale out storage &amp; big compute finalAvere Systems
 
Microsoft Azure
Microsoft AzureMicrosoft Azure
Microsoft AzureDavid Chou
 
Transforming a Large Mission-Critical E-Commerce Platform from a Relational A...
Transforming a Large Mission-Critical E-Commerce Platform from a Relational A...Transforming a Large Mission-Critical E-Commerce Platform from a Relational A...
Transforming a Large Mission-Critical E-Commerce Platform from a Relational A...MongoDB
 
Webinar: What's New in MongoDB 3.2
Webinar: What's New in MongoDB 3.2Webinar: What's New in MongoDB 3.2
Webinar: What's New in MongoDB 3.2MongoDB
 
Marketing Automation at Scale: How Marketo Solved Key Data Management Challen...
Marketing Automation at Scale: How Marketo Solved Key Data Management Challen...Marketing Automation at Scale: How Marketo Solved Key Data Management Challen...
Marketing Automation at Scale: How Marketo Solved Key Data Management Challen...Continuent
 

Similar a 在-MongoDB-Cloud-上構建無服務器化應用 (20)

Serverless_with_MongoDB
Serverless_with_MongoDBServerless_with_MongoDB
Serverless_with_MongoDB
 
How leading financial services organisations are winning with tech
How leading financial services organisations are winning with techHow leading financial services organisations are winning with tech
How leading financial services organisations are winning with tech
 
Discover MongoDB Atlas and MongoDB Stitch - DEM02-S - Mexico City AWS Summit
Discover MongoDB Atlas and MongoDB Stitch - DEM02-S - Mexico City AWS SummitDiscover MongoDB Atlas and MongoDB Stitch - DEM02-S - Mexico City AWS Summit
Discover MongoDB Atlas and MongoDB Stitch - DEM02-S - Mexico City AWS Summit
 
Cloud Data Strategy event London
Cloud Data Strategy event LondonCloud Data Strategy event London
Cloud Data Strategy event London
 
La creación de una capa operacional con MongoDB
La creación de una capa operacional con MongoDBLa creación de una capa operacional con MongoDB
La creación de una capa operacional con MongoDB
 
Data Streaming with Apache Kafka & MongoDB
Data Streaming with Apache Kafka & MongoDBData Streaming with Apache Kafka & MongoDB
Data Streaming with Apache Kafka & MongoDB
 
MongoDB .local Toronto 2019: MongoDB Atlas Jumpstart
MongoDB .local Toronto 2019: MongoDB Atlas JumpstartMongoDB .local Toronto 2019: MongoDB Atlas Jumpstart
MongoDB .local Toronto 2019: MongoDB Atlas Jumpstart
 
MongoDB - General Purpose Database
MongoDB - General Purpose DatabaseMongoDB - General Purpose Database
MongoDB - General Purpose Database
 
Accelerating a Path to Digital With a Cloud Data Strategy
Accelerating a Path to Digital With a Cloud Data StrategyAccelerating a Path to Digital With a Cloud Data Strategy
Accelerating a Path to Digital With a Cloud Data Strategy
 
The New Normal - AWSome Day Zurich 112016
The New Normal - AWSome Day Zurich 112016The New Normal - AWSome Day Zurich 112016
The New Normal - AWSome Day Zurich 112016
 
What’s New in AWS Database Services
What’s New in AWS Database ServicesWhat’s New in AWS Database Services
What’s New in AWS Database Services
 
Mongo db multidc_webinar
Mongo db multidc_webinarMongo db multidc_webinar
Mongo db multidc_webinar
 
Why NBC Universal Migrated to MongoDB Atlas
Why NBC Universal Migrated to MongoDB AtlasWhy NBC Universal Migrated to MongoDB Atlas
Why NBC Universal Migrated to MongoDB Atlas
 
Transforming a Large Mission-Critical E-Commerce Platform from a Relational A...
Transforming a Large Mission-Critical E-Commerce Platform from a Relational A...Transforming a Large Mission-Critical E-Commerce Platform from a Relational A...
Transforming a Large Mission-Critical E-Commerce Platform from a Relational A...
 
Getting Started with Managed Database Services on AWS - AWS Summit Tel Aviv 2017
Getting Started with Managed Database Services on AWS - AWS Summit Tel Aviv 2017Getting Started with Managed Database Services on AWS - AWS Summit Tel Aviv 2017
Getting Started with Managed Database Services on AWS - AWS Summit Tel Aviv 2017
 
Solving enterprise challenges through scale out storage &amp; big compute final
Solving enterprise challenges through scale out storage &amp; big compute finalSolving enterprise challenges through scale out storage &amp; big compute final
Solving enterprise challenges through scale out storage &amp; big compute final
 
Microsoft Azure
Microsoft AzureMicrosoft Azure
Microsoft Azure
 
Transforming a Large Mission-Critical E-Commerce Platform from a Relational A...
Transforming a Large Mission-Critical E-Commerce Platform from a Relational A...Transforming a Large Mission-Critical E-Commerce Platform from a Relational A...
Transforming a Large Mission-Critical E-Commerce Platform from a Relational A...
 
Webinar: What's New in MongoDB 3.2
Webinar: What's New in MongoDB 3.2Webinar: What's New in MongoDB 3.2
Webinar: What's New in MongoDB 3.2
 
Marketing Automation at Scale: How Marketo Solved Key Data Management Challen...
Marketing Automation at Scale: How Marketo Solved Key Data Management Challen...Marketing Automation at Scale: How Marketo Solved Key Data Management Challen...
Marketing Automation at Scale: How Marketo Solved Key Data Management Challen...
 

Más de Amazon Web Services

Come costruire servizi di Forecasting sfruttando algoritmi di ML e deep learn...
Come costruire servizi di Forecasting sfruttando algoritmi di ML e deep learn...Come costruire servizi di Forecasting sfruttando algoritmi di ML e deep learn...
Come costruire servizi di Forecasting sfruttando algoritmi di ML e deep learn...Amazon Web Services
 
Big Data per le Startup: come creare applicazioni Big Data in modalità Server...
Big Data per le Startup: come creare applicazioni Big Data in modalità Server...Big Data per le Startup: come creare applicazioni Big Data in modalità Server...
Big Data per le Startup: come creare applicazioni Big Data in modalità Server...Amazon Web Services
 
Esegui pod serverless con Amazon EKS e AWS Fargate
Esegui pod serverless con Amazon EKS e AWS FargateEsegui pod serverless con Amazon EKS e AWS Fargate
Esegui pod serverless con Amazon EKS e AWS FargateAmazon Web Services
 
Costruire Applicazioni Moderne con AWS
Costruire Applicazioni Moderne con AWSCostruire Applicazioni Moderne con AWS
Costruire Applicazioni Moderne con AWSAmazon Web Services
 
Come spendere fino al 90% in meno con i container e le istanze spot
Come spendere fino al 90% in meno con i container e le istanze spot Come spendere fino al 90% in meno con i container e le istanze spot
Come spendere fino al 90% in meno con i container e le istanze spot Amazon Web Services
 
Rendi unica l’offerta della tua startup sul mercato con i servizi Machine Lea...
Rendi unica l’offerta della tua startup sul mercato con i servizi Machine Lea...Rendi unica l’offerta della tua startup sul mercato con i servizi Machine Lea...
Rendi unica l’offerta della tua startup sul mercato con i servizi Machine Lea...Amazon Web Services
 
OpsWorks Configuration Management: automatizza la gestione e i deployment del...
OpsWorks Configuration Management: automatizza la gestione e i deployment del...OpsWorks Configuration Management: automatizza la gestione e i deployment del...
OpsWorks Configuration Management: automatizza la gestione e i deployment del...Amazon Web Services
 
Microsoft Active Directory su AWS per supportare i tuoi Windows Workloads
Microsoft Active Directory su AWS per supportare i tuoi Windows WorkloadsMicrosoft Active Directory su AWS per supportare i tuoi Windows Workloads
Microsoft Active Directory su AWS per supportare i tuoi Windows WorkloadsAmazon Web Services
 
Database Oracle e VMware Cloud on AWS i miti da sfatare
Database Oracle e VMware Cloud on AWS i miti da sfatareDatabase Oracle e VMware Cloud on AWS i miti da sfatare
Database Oracle e VMware Cloud on AWS i miti da sfatareAmazon Web Services
 
Crea la tua prima serverless ledger-based app con QLDB e NodeJS
Crea la tua prima serverless ledger-based app con QLDB e NodeJSCrea la tua prima serverless ledger-based app con QLDB e NodeJS
Crea la tua prima serverless ledger-based app con QLDB e NodeJSAmazon Web Services
 
API moderne real-time per applicazioni mobili e web
API moderne real-time per applicazioni mobili e webAPI moderne real-time per applicazioni mobili e web
API moderne real-time per applicazioni mobili e webAmazon Web Services
 
Database Oracle e VMware Cloud™ on AWS: i miti da sfatare
Database Oracle e VMware Cloud™ on AWS: i miti da sfatareDatabase Oracle e VMware Cloud™ on AWS: i miti da sfatare
Database Oracle e VMware Cloud™ on AWS: i miti da sfatareAmazon Web Services
 
Tools for building your MVP on AWS
Tools for building your MVP on AWSTools for building your MVP on AWS
Tools for building your MVP on AWSAmazon Web Services
 
How to Build a Winning Pitch Deck
How to Build a Winning Pitch DeckHow to Build a Winning Pitch Deck
How to Build a Winning Pitch DeckAmazon Web Services
 
Building a web application without servers
Building a web application without serversBuilding a web application without servers
Building a web application without serversAmazon Web Services
 
AWS_HK_StartupDay_Building Interactive websites while automating for efficien...
AWS_HK_StartupDay_Building Interactive websites while automating for efficien...AWS_HK_StartupDay_Building Interactive websites while automating for efficien...
AWS_HK_StartupDay_Building Interactive websites while automating for efficien...Amazon Web Services
 
Introduzione a Amazon Elastic Container Service
Introduzione a Amazon Elastic Container ServiceIntroduzione a Amazon Elastic Container Service
Introduzione a Amazon Elastic Container ServiceAmazon Web Services
 

Más de Amazon Web Services (20)

Come costruire servizi di Forecasting sfruttando algoritmi di ML e deep learn...
Come costruire servizi di Forecasting sfruttando algoritmi di ML e deep learn...Come costruire servizi di Forecasting sfruttando algoritmi di ML e deep learn...
Come costruire servizi di Forecasting sfruttando algoritmi di ML e deep learn...
 
Big Data per le Startup: come creare applicazioni Big Data in modalità Server...
Big Data per le Startup: come creare applicazioni Big Data in modalità Server...Big Data per le Startup: come creare applicazioni Big Data in modalità Server...
Big Data per le Startup: come creare applicazioni Big Data in modalità Server...
 
Esegui pod serverless con Amazon EKS e AWS Fargate
Esegui pod serverless con Amazon EKS e AWS FargateEsegui pod serverless con Amazon EKS e AWS Fargate
Esegui pod serverless con Amazon EKS e AWS Fargate
 
Costruire Applicazioni Moderne con AWS
Costruire Applicazioni Moderne con AWSCostruire Applicazioni Moderne con AWS
Costruire Applicazioni Moderne con AWS
 
Come spendere fino al 90% in meno con i container e le istanze spot
Come spendere fino al 90% in meno con i container e le istanze spot Come spendere fino al 90% in meno con i container e le istanze spot
Come spendere fino al 90% in meno con i container e le istanze spot
 
Open banking as a service
Open banking as a serviceOpen banking as a service
Open banking as a service
 
Rendi unica l’offerta della tua startup sul mercato con i servizi Machine Lea...
Rendi unica l’offerta della tua startup sul mercato con i servizi Machine Lea...Rendi unica l’offerta della tua startup sul mercato con i servizi Machine Lea...
Rendi unica l’offerta della tua startup sul mercato con i servizi Machine Lea...
 
OpsWorks Configuration Management: automatizza la gestione e i deployment del...
OpsWorks Configuration Management: automatizza la gestione e i deployment del...OpsWorks Configuration Management: automatizza la gestione e i deployment del...
OpsWorks Configuration Management: automatizza la gestione e i deployment del...
 
Microsoft Active Directory su AWS per supportare i tuoi Windows Workloads
Microsoft Active Directory su AWS per supportare i tuoi Windows WorkloadsMicrosoft Active Directory su AWS per supportare i tuoi Windows Workloads
Microsoft Active Directory su AWS per supportare i tuoi Windows Workloads
 
Computer Vision con AWS
Computer Vision con AWSComputer Vision con AWS
Computer Vision con AWS
 
Database Oracle e VMware Cloud on AWS i miti da sfatare
Database Oracle e VMware Cloud on AWS i miti da sfatareDatabase Oracle e VMware Cloud on AWS i miti da sfatare
Database Oracle e VMware Cloud on AWS i miti da sfatare
 
Crea la tua prima serverless ledger-based app con QLDB e NodeJS
Crea la tua prima serverless ledger-based app con QLDB e NodeJSCrea la tua prima serverless ledger-based app con QLDB e NodeJS
Crea la tua prima serverless ledger-based app con QLDB e NodeJS
 
API moderne real-time per applicazioni mobili e web
API moderne real-time per applicazioni mobili e webAPI moderne real-time per applicazioni mobili e web
API moderne real-time per applicazioni mobili e web
 
Database Oracle e VMware Cloud™ on AWS: i miti da sfatare
Database Oracle e VMware Cloud™ on AWS: i miti da sfatareDatabase Oracle e VMware Cloud™ on AWS: i miti da sfatare
Database Oracle e VMware Cloud™ on AWS: i miti da sfatare
 
Tools for building your MVP on AWS
Tools for building your MVP on AWSTools for building your MVP on AWS
Tools for building your MVP on AWS
 
How to Build a Winning Pitch Deck
How to Build a Winning Pitch DeckHow to Build a Winning Pitch Deck
How to Build a Winning Pitch Deck
 
Building a web application without servers
Building a web application without serversBuilding a web application without servers
Building a web application without servers
 
Fundraising Essentials
Fundraising EssentialsFundraising Essentials
Fundraising Essentials
 
AWS_HK_StartupDay_Building Interactive websites while automating for efficien...
AWS_HK_StartupDay_Building Interactive websites while automating for efficien...AWS_HK_StartupDay_Building Interactive websites while automating for efficien...
AWS_HK_StartupDay_Building Interactive websites while automating for efficien...
 
Introduzione a Amazon Elastic Container Service
Introduzione a Amazon Elastic Container ServiceIntroduzione a Amazon Elastic Container Service
Introduzione a Amazon Elastic Container Service
 

在-MongoDB-Cloud-上構建無服務器化應用

  • 1. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T 在 MongoDB Cloud上構建無服務器化應用 唐建法 大中國區首席架構師 MongoDB • S e s s i o n I D
  • 2. 2 MongoDB at a glance Revenue ($MM) $114.8 $166.0 $267.0 FY17 FY18 FY19 • Headquartered in New York, NY • 1,200+ global employees • 13,400+ customers in over 100 countries • 60MM+ total downloads of MongoDB Community Server • >120% net ARR expansion rate over each of the last sixteen quarters Note: Fiscal year ending January 31
  • 3. Massive adoption of MongoDB MongoDB vs. NoSQL skills on LinkedIn Activity index on Stack Overflow - 20,000 40,000 60,000 80,000 100,000 120,000 2012 2013 2014 2015 2016 MongoDB Redis Cassandra Hbase Other Other HBase Cassandra Redis More developers want to work with MongoDB this year than any other database – Stack Overflow Developer Survey (2018) Source: 451 Research Source: StackOverkill Neo4j HBase Cassandra Redis
  • 4. Leading modern general purpose database Creative Cloud Fintech Real-Time Travel Search Mobile Drug Applications Mobile Banking Multi-Screen TV Internet of Things Platform Predictive Messaging Background Checks as a Service Order Capture Cryptocurrency Platform Logistics Modernization E-Commerce System Entry Decision System Social Security Benefits Program Mobile App for Patient Data Product Catalog Single View of Patient Genetic Analysis Online Lending Swap Equities Management E-Commerce Personalization E-Commerce Platform Marketing Cloud Video Streaming Log Metadata Store Social Media Management Website Platform Product Catalog Identity Theft Protection Mass Spectrometer Instrumentation Subscriber QoS Shopping Cart Gaming Platform Online Tax Returns Real-Time Analytics social
  • 6. Customers have two choices: Self-managed or DBaaS Cloud Migration or Cloud First Self-Managed Aka “Lift and Shift” Database as a service Slow and complicated No elasticity Highly manual Reduces ROI and agility Self-service Fully elastic Consumption based Reduces TCO and accelerates time to value Fork in the road
  • 7. 7 The TRAP of doing it yourself Provision servers Configure high availability Configure security Configure and test backup Install and configure monitoring Ongoing upgrades and maintenance Application development Performance optimization Manual work is the hallmark of low- performing IT organizations. Deployments 64% more manual work Config. Mgmt. 65% more manual work Testing 40% more manual work 2017 State of DevOps Report, Puppet
  • 8. MongoDB Atlas — Global Cloud Database Self-service & elastic Deploy, modify, and upgrade on demand with best-in-class operational automation Automated database maintenance Database and infrastructure resources as code Scale up, out, or down in a few clicks or API calls Global & cloud-agnostic Available in 60+ regions across globe Global clusters for read/write anywhere deployments and multi-region fault tolerance Easy migrations with a consistent experience across cloud providers Enterprise-grade security & SLAs Network isolation, VPC peering, end-to-end encryption, and role-based access controls Encryption key management, LDAP integration, granular database auditing SOC 2 / Privacy Shield / HIPAA Guaranteed reliability with SLAs Comprehensive monitoring Deep visibility into 100+ KPIs with proactive alerting Real-time performance tracking and Performance Advisor APIs to integrate with monitoring dashboards Managed backup Point-in-time data recovery Queryable backup snapshots Consistent snapshots of sharded deployments Cloud data mobility Stitch: Serverless platform services Simple, serverless functions for backend logic, service integrations, and APIs Database access from your frontend secured by straightforward, field-level access rules Database and authentication triggers to react to changes in real time
  • 9. MongoDB as a service on AWS MongoDB Atlas is currently available in 16 AWS regions. • us-east-1 (N. Virginia) • us-east-2 (Ohio) • us-west-2 (Oregon) • us-west-1 (N. California) • ca-central-1 (Canada) • sa-east-1 (São Paulo) Americas • ap-east-1 (Hong Kong) • ap-southeast-1 (Singapore) • ap-southeast-2 (Sydney) • ap-northeast-1 (Tokyo) • ap-northeast-2 (Seoul) • ap-south-1 (Mumbai) Asia • eu-west-1 (Dublin) • eu-west-2 (London) • eu-west-3 (Paris) • eu-north-1 (Stockholm) • eu-central-1 (Frankfurt) Europe
  • 10. Highly available by default • A minimum of three data nodes per replica set/shard are automatically deployed across zones for high availability • If your primary node does go down for any reason, the self healing recovery process in MongoDB Atlas will typically occur in under 2 seconds Application Driver Primary Secondary Secondary Replication
  • 11. Cross-region replication • Ensure uptime in the unlikely event of a multi- zone or total region outage • Get improved performance for local reads by geographically distributing read-only replica set members that do not participate in the failover process • Available for Atlas deployments running on dedicated instances in AWS
  • 12. Fine-grained monitoring and alerts ● Monitoring and alerts provide full metrics on the state of your cluster’s database and server usage ● Automatic notifications when your database operations or server usage reach defined thresholds that affect your cluster's performance ● Combining our automated alerting with the flexible scale-up-and-out options in MongoDB Atlas, we can keep your database-supported applications always performing as well as they should
  • 13. Continuous backup • MongoDB Atlas continuously backs up your data, ensuring your backups are typically just a few seconds behind the operational system • Point-in-time backup of replica sets and consistent, cluster- wide snapshots of sharded clusters. With MongoDB Atlas, you can easily and safely restore to precisely the moment you need • Compression and block-level deduplication technology keeps your backup processes as efficient as possible • Backups are securely stored in North America, Ireland, Germany, United Kingdom, or Australia*. For more location flexibility of your backup data, you can utilize MongoDB’s mongodump / mongorestore tools *Additional regions for continuous backup coming soon
  • 14. Global Clusters Distribute your fully automated database across multiple geographically distributed zones made up of one or more cloud regions ● Read and write locally to provide single-digit millisecond latency for your distributed applications ● Ensure that data from certain geographies lives in predefined zones ● Easily deploy using prebuilt zone templates or build your own zones by choosing cloud regions in an easy-to-use, visual interface
  • 16. App Backend Infrastructure Core Database Functionality Storage Service integrations, data access control Code that moves the business forward Managing OS, Scale, Security, Backups, etc. Typical Technology Stack
  • 17. App Backend Infrastructure Core Database Functionality Storage Service integrations, data access control Code that moves the business forward Managing OS, Scale, Security, Backups, etc. Utilize Database-as-a-Service DBaaS
  • 18. App Backend Infrastructure Core Database Functionality Storage Service integrations, data access control Code that moves the business forward Managing OS, Scale, Security, Backups, etc. Add Backend-as-a-Service DBaaS BaaS
  • 19. App Backend Infrastructure Core Database Functionality Storage Service integrations, data access control Code that moves the business forward Managing OS, Scale, Security, Backups, etc. DBaaS BaaS You should focus here And Focus Your Energy Where You Can Make a Difference
  • 20. App Backend Infrastructure Core Database Functionality Storage Service integrations, data access control Code that moves the business forward Managing OS, Scale, Security, Backups, etc. And Focus Your Energy Where You Can Make a Difference MongoDB Atlas MongoDB Stitch You should focus here Fully managed Elastic scale Highly Available Secure
  • 22. Basic Blog Tutorial <html> <head> </head> <body> <h3>This is a great blog post</h3> <div id="content"> I like to write about technology because I want to get on the front page of hacker news. (In a good way) </div> <hr> <div id="comments"></div> </body> </html> Nothing Special with the first step. Its basic HTML. Save the file as BasicBlogDemo.html and double click the file, it will open in your browser. You can see the header, the content and the hard rule at the bottom
  • 23. Basic Blog Tutorial <html> <head> <script src="https://s3.amazonaws.com/stitch-sdks/js/bundles/4.0.0/stitch.js"></script> </head> <body> <h3>This is a great blog post</h3> <div id="content"> I like to write about technology because I want to get on the front page of hacker news. (In a good way) </div> <hr> <div id="comments"></div> </body> </html> Ok, we just now included the stitch client browser SDK!
  • 24. Basic Blog Tutorial <html> <head> <script src="https://s3.amazonaws.com/stitch-sdks/js/bundles/4.0.0/stitch.js"></script> <script> // Initialize the App Client const client = stitch.Stitch.initializeDefaultAppClient("<your-app-id>"); // Get a MongoDB Service Client const mongodb = client.getServiceClient(stitch.RemoteMongoClient.factory,"mongodb- atlas"); // Get a reference to the blog database const db = mongodb.db("blog"); </script> </head> <body> <h3>This is a great blog post</h3> <div id="content"> I like to write about technology because I want to get on the front page of hacker news. (In a good way) </div> <hr> <div id="comments"></div> </body> </html> Stitch client browser SDK Stitch APP ID Stitch Client Connection Stitch Database We now have everything we need to connect to the Atlas database instance for our Application!
  • 25. Basic Blog Tutorial<html> <head> <script src="https://s3.amazonaws.com/stitch-sdks/js/bundles/4.0.0/stitch.js"></script> <script> // Initialize the App Client const client = stitch.Stitch.initializeDefaultAppClient("<your-app-id>"); // Get a MongoDB Service Client const mongodb = client.getServiceClient(stitch.RemoteMongoClient.factory,"mongodb- atlas"); // Get a reference to the blog database const db = mongodb.db("blog"); function displayComments() { db.collection('comments').find({}, {limit: 1000}).asArray() .then(docs => { const html = docs.map(c => "<div>" + c.comment + "</div>").join(""); document.getElementById("comments").innerHTML = html; }); } </script> </head> <body> <h3>This is a great blog post</h3> <div id="content"> I like to write about technology because I want to get on the front page of hacker news. (In a good way) </div> <hr> <div id="comments"></div> </body> </html> Our first real function! Then we display them in the comments div as html for the user to view We specify the comments collection We find the documents, and specify a limit of 1,000 We Loop through the array of documents and store them in a variable called html.
  • 26. Basic Blog Tutorial<html> <head> <script src="https://s3.amazonaws.com/stitch-sdks/js/bundles/4.0.0/stitch.js"></script> <script> // Initialize the App Client const client = stitch.Stitch.initializeDefaultAppClient("<your-app-id>"); // Get a MongoDB Service Client const mongodb = client.getServiceClient(stitch.RemoteMongoClient.factory,"mongodb- atlas"); // Get a reference to the blog database const db = mongodb.db("blog"); function displayComments() { db.collection('comments').find({}, {limit: 1000}).asArray() .then(docs => { const html = docs.map(c => "<div>" + c.comment + "</div>").join(""); document.getElementById("comments").innerHTML = html; }); } function displayCommentsOnLoad() { client.auth .loginWithCredential(new stitch.AnonymousCredential()) .then(displayComments) .catch(console.error); } </script> </head> <body> <h3>This is a great blog post</h3> <div id="content"> I like to write about technology because I want to get on the front page of hacker news. (In a good way) </div> <hr> <div id="comments"></div> </body onload="displayCommentsOnLoad()"> </html> Our next function logs us into our database We have connected to the database and run our first query! Check the stitch console logs. It calls the display comments function after logging in. The function to connect to the database is called in the body onload... Save the changes and refresh the browser.
  • 27. Basic Blog Tutorial... function addComment() { const newComment = document.getElementById("new_comment"); console.log("add comment", client.auth.user.id) db.collection("comments") .insertOne({ owner_id : client.auth.user.id, comment: newComment.value }) .then(displayComments); newComment.value = ""; } function displayComments() { db.collection('comments').find({}, {limit: 1000}).asArray() .then(docs => { const html = docs.map(c => "<div>" + c.comment + "</div>").join(""); document.getElementById("comments").innerHTML = html; }); } ... </script> </head> <body> <h3>This is a great blog post</h3> <div id="content"> I like to write about technology because I want to get on the front page of hacker news. (In a good way) </div> <hr> Add comment: <input id="new_comment"><BR> <input type="submit" onClick="addComment()"> <hr> <div id="comments"></div> </body onload="displayCommentsOnLoad()"> </html> Now we insert a comment into our Atlas database through the stitch API, and then retrieve it for display The value we insert is obtained from an input field added here. The add comment function is called from the submit button Our first stitch App is complete!
  • 28. Basic Blog Tutorial Play with it, add more comments. Add new fields, see what happens. You are well on your way to being able to start writing a new application. You now have a basic understanding and are ready for more.
  • 29. The Server-less Architecture Accelerates Everything Cloud Infrastructure Services and APIs Application Logic MongoDB Atlas Rapidly deploy, dynamically scale, and distribute databases across regions and cloud providers MongoDB Stitch Serverless platform that allows developers to focus on innovation rather than plumbing, services orchestration, and boilerplate code 2-5x increase in productivity by leveraging the MongoDB Atlas + Stitch Client Application or Service Application Logic DataData generated from your application is sent and retrieved through the Stitch Client SDK
  • 30. Thank you! S U M M I T © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. 唐建法 jianfa.tang@mongodb.com