11. 11
Fully Indexable
Fully featured secondary indexes
• Primary Index
Every Collection has a primary key index
• Compound Index
Index against multiple keys in the document
• MultiKey Index
Index into arrays
• Text Indexes
Support for text searches
• GeoSpatial Indexes
2d & 2dsphere indexes for spatial geometries
• Hashed Indexes
Hashed based values for sharding
Index Types
• TTL Indexes
Single Field indexes, when expired delete the document
• Unique Indexes
Ensures value is not duplicated
• Partial Indexes
Expression based indexes, allowing indexes on subsets of data
• Case Insensitive Indexes
supports text search using case insensitive search
• Sparse Indexes
Only index documents which have the given field
Index Features
14. 14
Compared to SQL JOINs and aggregation
SELECT
city,
SUM(annual_spend) Total_Spend,
AVG(annual_spend) Average_Spend,
MAX(annual_spend) Max_Spend,
COUNT(annual_spend) customers
FROM (
SELECT t1.city, customer.annual_spend
FROM customer
LEFT JOIN (
SELECT address.address_id, city.city,
address.customer_id, address.location
FROM address LEFT JOIN city
ON address.city_id = city.city_id
) AS t1
ON
(customer.customer_id = t1.customer_id AND
t1.location = "home")
) AS t2
GROUP BY city;
SQL queries have a
nested structure
Understanding the outer
layers requires
understanding the inner
ones
So SQL has to be read
“inside-out”
15. 15
db.customers.aggregate([
{
$unwind: "$address",
},
{
$match: {"address.location": "home"}
},
{
$group: {
_id: "$address.city",
totalSpend: {$sum: "$annualSpend"},
averageSpend: {$avg: "$annualSpend"},
maximumSpend: {$max: "$annualSpend"},
customers: {$sum: 1}
}
}
])
Versatile: Complex queries fast to create, optimize, & maintain
MongoDB’s aggregation framework has the flexibility you need to get
value from your data, but without the complexity and fragility of SQL
These “phases” are distinct and
easy to understand
They can be thought about in
order… no nesting.
28. #MDBlocal#MDBlocal
MongoDB 3.6 adds compression
of wire protocol traffic between
client and database
• Up to 80% bandwidth savings
MongoDB End to End
Compression
• Wire protocol
• Intra-cluster
• Indexes in memory
• Storage
Application
MongoDB Primary
Replica
Wire Protocol
Compression
MongoDB Secondary Replica
Single ViewMongoDB Secondary Replica
Single ViewMongoDB Secondary Replica
Single ViewMongoDB Secondary Replica
Single ViewMongoDB Secondary Replica
MongoDB Secondary Replica
Intra-Cluster
Compression
Compression
of
Data on Disk
Compression of
Indexes in
Memory
End to End Compression
30. #MDBlocal#MDBlocal
JSON Schema
Enforces strict schema structure over a complete collection
for data governance & quality
• Builds on document validation introduced by restricting new content that
can be added to a document
• Enforces presence, type, and values for document content, including
nested array
• Simplifies application logic
Tunable: enforce document structure, log warnings, or allow
complete schema flexibility
Queryable: identify all existing documents that do not comply
35. Characteristics of Change Streams
•Resumable
•Targeted Changes
•Total ordering
•Durability
•Security
•Ease of use
•Idempotence
36. Characteristics of Retryable Writes
•Automatic Drivers logic
• Network errors
• Elections
• NOT for logic errors
•Safe
• For both non-idempotent and idempotent writes
• NOT for multi: true
37. Retryable Writes => Super easy!
uri = "mongodb://example.com:27017/?retryWrites=true"
client = MongoClient(uri)
database = client.database
collection = database.collection
38. 38
Easy: MongoDB Multi-Document ACID Transactions
Just like relational transactions
• Multi-statement, familiar relational syntax
• Easy to add to any application
• Multiple documents in 1 or many collections and
databases
ACID guarantees
• Snapshot isolation, all or nothing execution
• No performance impact for non-transactional operations
Planning
• MongoDB 4.0: replica set
• MongoDB 4.2: extended to sharded clusters
39. 39
Sophisticated Analytics & Visualizations Of Data In Place
• Rich MongoDB query
language & idiomatic
drivers
• Connector for BI
• Connector for Spark
• Charts (beta)
40. MongoDB Charts: Create, Visualize, Share
Work with complex data Connect to data sources securely.
Filter. Sample. Visualize.
Share dashboards and
collaborate
45. Cloud ManagerOps Manager MongoDB Atlas
Private DBaaS
Compatibility multi-environment
Hybrid DBaaS Public DBaaS
Fully managed
Same codebase, same API & same UI
46. 46
Operational Agility – Atlas - Database as a
Service
Self-service, elastic,
and automated
Secure by defaultGlobal and highly
available
Continuous
backups
Real-time monitoring and
optimization
Cloud agnostic
48. 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.
Time
40%
40%
20%
49. 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.
MongoDB
Atlas
Time
40%
40%
20%
50. 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.
MongoDB
Atlas
MongoDB
Stitch Fully managed
Elastic scale
Highly Available
Secure
Time
40%
40%
20%
51. 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.
MongoDB
Atlas
MongoDB
Stitch Fully managed
Elastic scale
Highly Available
Secure
Customer can focus here
Time
40%
40%
20%
52. Streamlines app development with simple, secure access to data and services from the client with thousands of lines less
code to write and no infrastructure to manage – getting your apps to market faster while reducing operational costs.
Stitch QueryAnywhere
Full power of MongoDB
document model & query
language in frontend code
Fine-grained security
policies through
declarative rules
MongoDB Stitch Serverless Platform Services
53. Streamlines app development with simple, secure access to data and services from the client with thousands of lines less
code to write and no infrastructure to manage – getting your apps to market faster while reducing operational costs.
Stitch QueryAnywhere
Full power of MongoDB
document model & query
language in frontend code
Fine-grained security
policies through
declarative rules
Stitch Functions
Run simple JavaScript
functions in Stitch’s
serverless environment
Power apps with Server-side
logic, or enable Data as a
Service with custom APIs.
MongoDB Stitch Serverless Platform Services
54. Streamlines app development with simple, secure access to data and services from the client with thousands of lines less
code to write and no infrastructure to manage – getting your apps to market faster while reducing operational costs.
Stitch QueryAnywhere
Full power of MongoDB
document model & query
language in frontend code
Fine-grained security
policies through
declarative rules
Stitch Functions
Run simple JavaScript
functions in Stitch’s
serverless environment
Power apps with Server-side
logic, or enable Data as a
Service with custom APIs.
Stitch Triggers
Real-time notifications that
launch functions in response
to changes in the database
Make further database
changes, push data to other
places, or interact with users
MongoDB Stitch Serverless Platform Services
55. Stitch QueryAnywhere
Full power of MongoDB
document model & query
language in frontend code
Fine-grained security
policies through
declarative rules
Stitch Functions
Run simple JavaScript
functions in Stitch’s
serverless environment
Power apps with Server-side
logic, or enable Data as a
Service with custom APIs.
Stitch Mobile Sync
Automatically synchronizes
data between documents
held locally in MongoDB
Mobile and the backend
database
(coming soon)
Streamlines app development with simple, secure access to data and services from the client with thousands of lines less
code to write and no infrastructure to manage – getting your apps to market faster while reducing operational costs.
Stitch Triggers
Real-time notifications that
launch functions in response
to changes in the database
Make further database
changes, push data to other
places, or interact with users
MongoDB Stitch Serverless Platform Services