Con MongoDB 3.6, podrá avanzar al ritmo que marcan sus datos. Los plazos de lanzamiento de las nuevas aplicaciones se acelerarán, y estas funcionarán de forma segura y fiable en entornos de cualquier tamaño, además de aportar información útil en tiempo real. https://www.mongodb.com/mongodb-3.6
2. Agenda
• Razones tecnológicas y de mercado para
MongoDB 3.6
• Key Features & Mejoras
• Desarrollo
• Operaciones
• Análisis y Ciencia de Datos
• Próximos Pasos
3. Digital Matters….
$4tn+ in
eCommerce sales
by 2020
75bn connected
devices
by 2025
61% see AI as an
“urgent” strategy
in 2017
$108bn AR/VR
market size
by 2021
59% smartphone
penetration
by 2022
$6tn+ in cyber-crime
damage
by 2021
5. Speed Matters…..But Digital is Hard
Forrester Digital Transformation Infographic: https://go.forrester.com/blogs/16-05-09-digital_transformation_2016_infographic/
9. MongoDB Change Streams
Enabling developers to build
reactive, real-time services
ChangeStreamsAPI
Business
Apps
User Data
Sensors
Clickstream
Real-Time
Event Notifications
Message Queue
10. Change Streams Implementation
Apps register for notifications via change
streams API on top of MongoDB oplog
• Change streams are:
• Flexible: deltas or the full document, filter on specific events only
• Consistent: total ordering of data across shards
• Secure: enforces collection’s user access privileges
• Reliable: only notifies once write committed on majority of replicas
• Resumable: from node failure
• Concurrent: up to 1,000 changes streams per MongoDB instance
• Familiar: use regular MongoDB query language and drivers
11. Change Streams Use Cases
• Refreshing trading apps as stock prices
change
• Syncing changes across microservices
• Updating dashboards, analytics systems,
search engines
• IoT data pipelines – e.g., generating alarms in
response to connected asset failures
• Push new credit card transactions into ML
models to recalculate risk
• Maintaining multiplayer game scoreboards
ChangeStreamsAPI
Business
Apps
User Data
Sensors
Clickstream
Real-Time
Event Notifications
Message Queue
12. Change Streams in Action
// Select the collection to query.
MongoCollection<Document> collection =
database.getCollection(”orders");
// Create the change stream cursor.
MongoCursor<Document> cursor =
collection.watch().iterator();
14. In the real world….
Business
Apps
User Data
Sensors
Clickstream
Write
ACK
…..failures happen……
…and the app has no way of
knowing if the write was
applied or not*
• Network failure stops write reaching MongoDB
• MongoDB primary undergoes an election
• Write succeeds, but network failure prevents
ACK delivery
* For idempotent operations, this is not an issue
15. Handling Write Failures
Business
Apps
User Data
Sensors
Clickstream
Write
ACK
But failures happen……
…and the app has no way of
knowing if the write was
applied or not
• Network failure stops write reaching MongoDB
• MongoDB primary undergoes an election
• Write succeeds, but network failure prevents
ACK delivery
Developers write
complex exception
handling code
16. MongoDB Retryable Writes
Write failure handling moved from the app to the
database for transient network errors or primary
elections
• Driver automatically retries failed write
• With a unique transaction identifier, server enforces exactly-once
processing semantics
• Properties
• Supports idempotent & non-idempotent operations, and errors caused
by time-outs
• Delivers always-on, global availability of write
operations
• Overcomes the complexity imposed by multi-master, eventually
consistent systems
17. Retryable Writes in Action
uri = "mongodb://example.com:27017/?retryWrites=true"
client = MongoClient(uri)
database = client.database
collection = database.collection
19. Tunable Consistency: Scaling Reads
MongoDB Primary
MongoDB Secondary
MongoDB Secondary
All writes
Some reads
Reads
Reads
Business
Apps
User
Data
Sensors
Click
stream
20. Tunable Consistency Controls
Balance data consistency with performance SLAs
• Developers have precise control over how queries are routed across the
database cluster
• Causal consistency: guarantees monotonic, logically
consistent reads from any replica node in the same user
session
• Sharded secondary reads: Secondary replicas now chunk-
aware, ensuring consistent reads even as data is being
rebalanced across a sharded cluster
21. Causal Consistency in Action
//start client session, which is causally consistent by default
try (ClientSession session =
client.startSession(ClientSessionOptions.builder().build())) {
//Run causally related operations within the session
collection.insertOne(session, ... );
collection.updateOne(session, ...);
try (MongoCursor<Document> cursor =
collection.find(session).filter(...).iterator()) {
while (cursor.hasNext()) {
Document cur = cursor.next();
}
}
22. Compass: The GUI for MongoDB
New features
• Query auto-complete
• Query history
• Table view
• Compass plugin framework
Compass Community
• No-cost edition
• GUI used alongside the shell
Download Compass Community
https://www.mongodb.com/download-center#compass
23. Query Expressivity & Fully
Expressive Array Updates
• Use aggregation pipeline expressions within the MongoDB
query language, using new $expr operator
• SQL equivalent of SELECT * FROM T1 WHERE a>b
• Example: find all customer accounts that have increased month on
month spend by $200 or more
• More expressive queries with less client-side code
• Atomically update multiple matching elements of an array
in a single update command
• Example: update all prices in an array by 20%
• More flexible data modeling
• Avoids document rewrites imposed by other databases
[ ]
27. Data Explorer
Inspect schema &
index utilization
Real-Time
Performance Panel
Live telemetry: in-flight operations &
resource consumption
Performance Advisor
Always-on index
recommendations
28. Ops Manager Backup & Restore
Continuous & Consistent Backups with Point in Time
Restore:
• Queryable Backups: Inspect backups without need to first restore
• Faster Backups: Refactored agent & improved initial sync
• Faster Recovery: Point in time snapshots now created at
destination node, reducing a network hop
• Backups to Object Stores: On-prem as well as S3
• Cross-Project Restores: Restore to different project from
snapshot source
29. Balancing Flexible Data Model with
Data Governance
{
product_name: ‘Acme Paint’,
color: [‘Red’, ‘Green’],
size_oz: [8, 32],
finish: [‘satin’, ‘eggshell’]
}
{
product_name: ‘T-shirt’,
size: [‘S’, ‘M’, ‘L’, ‘XL’],
color: [‘Heather Gray’ … ],
material: ‘100% cotton’,
wash: ‘cold’,
dry: ‘tumble dry low’
}
{
product_name: ‘Mountain Bike’,
brake_style: ‘mechanical disc’,
color: ‘grey’,
frame_material: ‘aluminum’,
no_speeds: 21,
package_height: ‘7.5x32.9x55’,
weight_lbs: 44.05,
suspension_type: ‘dual’,
wheel_size_in: 26
}
Documents in the same product catalog collection in MongoDB
30. Schema Validation
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
33. Extending Security Controls
New in MongoDB 3.6
• Bind to Localhost: RPM & DEB defaults extended to all packages &
platforms. Denies all external connections to the database until
permitted by the admin
• IP Whitelisting: Only accept external connections from defined IP
addresses or CIDR blocks
34. User Authentication IP Address
Whitelisting
db.createUser(), db.updateUser(), db.createRole(), db.updateRole()
192.168.1.25
Application
Application
System Administrator
192.168.1.48
172.16.4.13
172.16.4.88
172.33.20.62
172.33.20.11
Restrict each user’s
authentication based on:
• Client IP Address Range
and/or
• Server IP Listen Address
35. End to End Compression
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
36. Multi-Tenancy Management
• Operational Session Management
• Admins can view, group, search every user session on every
node in the cluster
• Kill operations running across multiple nodes in a single command
• 1m+ WiredTiger Collections
• Refactored WiredTiger internals to support applications
generating thousands of collections per instance
• SaaS apps: collection per user
• IoT services: collection per asset per hour
37. • Connector for BI
• Aggregation Pipeline
• R Driver
Speed to Insight
39. • Faster
• Takes advantage of 3.6 expressive Lookup to push more
computation into the database
• Supports Show Status function to enable deeper performance
optimization
• Simpler
• Lifecycle management with Ops Manager
• Schema sampling and mapping now managed by the the
mongosqld process, rather than separate utility
• Authenticate via client-side plugins, rather than managing TLS
certificates. Kerberos support added
What’s New in the BI Connector
40. Richer Aggregation Pipeline
• Expressive $lookup
• Beyond Left Outer equi-join. Now supports non equi-joins &
subqueries
• Executed natively in the database, allowing more complex
analytics queries with less code
• Timezone-aware aggregations
• Enables multi-region analysis that are aware of region-specific
timezones and working days when grouping data
• New expressions for richer transformations
• Convert to and from objects to arrays of K-V pairs
• Merge multiple objects into a single object
• Remove fields from an object based on evaluation criteria
42. R Driver for MongoDB
Recommended MongoDB R driver for data scientists,
developers & statisticians
• Idiomatic, native language access to the database
• MongoDB read & write concerns to control data
consistency & durability
• Data security with enterprise authentication
mechanisms
• Advanced BSON data types, e.g., Decimal 128 for
high precision scientific & financial analysis
43. Cloud ManagerOps Manager MongoDB Atlas
Private DBaaS:
On-Prem
Run Anywhere
Eliminating Lock-In
Hybrid DBaaS
Public DBaaS:
Fully Managed
Same Code Base, Same API, Same Management UI
44. MongoDB 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
45. What’s New in Atlas
● Availability of MongoDB 3.6 in
MongoDB Atlas (at GA)
● Cross-region replication
● Storage auto-scaling
● Pause Cluster
● Always-on performance advisor
● Cross project restores
Auto-storage
scaling
49. Getting Started with MongoDB 3.6
• Download the release candidate &
review the Release Notes
• Read the What’s New whitepaper
• Free MongoDB University Training
• We can help: Major Version Upgrade Service
https://www.mongodb.com/download-center#development
https://docs.mongodb.com/master/release-notes/3.6/
https://www.mongodb.com/collateral/mongodb-36-whats-new
https://university.mongodb.com/courses/M036/about
https://www.mongodb.com/products/consulting