More Related Content Similar to SH 1 - SES 2 part 2 - Tel Aviv MDBlocal - Eliot Keynote.pptx Similar to SH 1 - SES 2 part 2 - Tel Aviv MDBlocal - Eliot Keynote.pptx (20) SH 1 - SES 2 part 2 - Tel Aviv MDBlocal - Eliot Keynote.pptx1. 1 6 J A N U A RY, 2 0 1 8 | H I LT O N
# M D B l o c a l
Eliot Horowitz
CTO & Co-Founder
@eliothorowitz
2. # M D B l o c a l
MongoDB Server 3.6
4. # M D B l o c a l
$lookup
6. $lookup in 3.6
orders:
{
...
line_items : [
{ id: 123,
title : "USB Battery",
price: 15.0 },
{ id: 512,
title : "Hip T-shirt",
price : 45.0 }
],
...
}
db.orders.aggregate([
{$unwind : … },
{$lookup:{
from: "reviews",
let: {p_id:"$line_items.id"},
pipeline: [
{$match: {p_id:{$expr:"$$p_id"}}},
{$group: {
_id : null,
rating:{$avg:"$rating"}
}} ],
as: "avgRating" },
{ … }
])
7. # M D B l o c a l
Arrays
9. Updating Arrays: All Elements
orders:
{
_id: 5,
line_items : [
{ id: 123,
title : "USB Battery",
price: 15.0 },
{ id: 512,
title : "Hip T-shirt",
price : 45.0 }
],
...
}
db.orders.update(
{ _id: 5 },
{ $mul: {
"line_items.$[].price":
0.8
}
}
)
10. Updating Arrays: Some Elements
orders:
{
_id: 5,
line_items : [
{ id: 123,
title : "USB Battery",
price: 15.0 },
{ id: 512,
title : "Hip T-shirt",
price : 45.0 }
],
...
}
11. Updating Arrays: Some Elements
orders:
{
_id: 5,
line_items : [
{ id: 123,
title : "USB Battery",
price: 15.0 },
shipped: true
{ id: 512,
title : "Hip T-shirt",
price : 45.0,
shipped: false }
],
}
db.orders.update(
{ _id: 5 },
{ $mul: {
"line_items.$[li].price":
0.8}},
{arrayFilters:[
{"li.shipped":{$ne:true}}
]}
)
12. Updating Arrays: Nested
{ "_id" : 5,
"line_items" : [
{ "id": 123,
"title": "USB Battery",
"price": 15.0,
"notify_when_ship": [{"name": "eliot", "phone": "123-456-7890"}],
"shipped": true },
{ "id": 512,
"title": "Hip T-shirt",
"price": 45.0,
"shipped": false }
]
}
13. # M D B l o c a l
Fully Expressive
Array Updates
14. # M D B l o c a l
JSON Schema
15. JSON Schema in Action
$jsonSchema: {
properties: {
line_items: {
type: "array",
items: {
properties: {
title: {type: "string"},
price: {type: "number", minimum: 0.0} },
required: ["_id", "title", "price"],
additionalProperties: false }}},
required: ["line_items"]
}
16. # M D B l o c a l
Retryable Writes
17. Retryable Writes in 3.6
# Specify connection string with retryable writes enabled.
uri = "mongodb://example.com:27017/?retryWrites=true"
# Connect and issue writes as usual
client = MongoClient(uri)
database = client.database
collection = database.collection
result = collection.update_one({'_id': 1},
{'$inc': {'n': 1}})
18. # M D B l o c a l
Local Host Only
By Default
19. # M D B l o c a l
Change Streams
20. Change Streams in Action
# Subscribe to change notifications in a collection.
cursor = client.my_db.my_collection.watch([
{'$match': {'operationType':
{'$in': ['insert', 'replace']}}},
{'$match': {'newDocument.n': {'$gte': 1}}}
])
# Loops forever.
for change in cursor:
print(change['newDocument'])
21. # M D B l o c a l
Introduction to Change Streams
WHERE
Shard 1
WHEN
15:00 – 15:40
ALY CABRAL
Product Manager,
Core Server
22. # M D B l o c a l
MongoDB Server 3.6
23. # M D B l o c a l
ALY CABRAL
Product Manager,
Core Server
How to Leverage
What's New in MongoDB 3.6
WHERE
Shard 1
WHEN
10:40 – 11:20
24. # M D B l o c a l
Business Intelligence
25. Property Value Accuracy
Mean of x 9 exact
Sample variance of x 11 exact
Mean of y 7.50 to 2 decimal places
Sample variance of y 4.125 plus/minus 0.003
Correlation between x and y 0.816 to 3 decimal places
Linear regression line y = 3.00 + 0.500x
to 2 and 3 decimal places,
respectively
Coefficient of determination of the linear regression 0.67 to 2 decimal places
Anscombe’s Quartet
Four datasets, all with the same…
26. 1 Picture > 1.0E3 Queries
12
10
8
6
4
124 6 6 10 14 16 18
Y1
X1
12
10
8
6
4
124 6 6 10 14 16 18
Y3
X3
12
10
8
6
4
124 6 6 10 14 16 18
Y2
X2
12
10
8
6
4
124 6 6 10 14 16 18
Y4
X4
27. # M D B l o c a l
BI Connector
29. # M D B l o c a l
BI Connector 2.0
30. Polymorphic Documents
{
_id: 1,
name: "Hip T-shirt",
price: 45.0,
size: "M",
description: "The
perfect balance of obscure
and iconic."
}
{
_id: 2,
name: "USB Battery",
price: 15.0,
mAh: 6000,
description: "Conferences
are phone-killers. Bring
backup."
}
31. Arrays
orders:
{
...
line_items : [
{ title : "USB Battery",
price: 15.0 },
{ title : "Hip T-shirt",
price : 45.0 }
],
...
},
...
1: Most popular items
USB Battery : 5
T-shirt : 4
etc.
2: Histogram of order price
< $10 : 20%
$10 - $29 : 15%
$30 - $99 : 40%
> $100 : 5%
34. # M D B l o c a l
Demo: MongoDB Charts
ANNA HERLIHY
Software
Engineer,
Compass
35. # M D B l o c a l
MongoDB Charts
Coming Soon
36. # M D B l o c a l
MongoDB Atlas
37. # M D B l o c a l
• Reliability
• Security
• Ease
• Elasticity
Why Atlas
38. # M D B l o c a l
• Free tier
• Live migration service
• Data browser
• Real-time performance
viewer
• Queryable backups
• Performance Advisor
• M2
• Pause Cluster
• Atlas BI Connector
• Datadog integration
Atlas Since Launch
40. # M D B l o c a l
Demo: MongoDB Atlas
TOMER YAKIR
Senior Technical
Services Engineer
41. # M D B l o c a l
• Full CRUD support
• Charts integration
• Auditing
• LDAP authentication
• KMIP integration
• Cross cloud
Atlas: Coming Soon
42. # M D B l o c a l
MongoDB Stitch
44. # M D B l o c a l
• Web as 1st-class UI
• Mobile
• IoT
What’s Changed Since 20047
46. A Modern App Needs…
A way to stitch
services together
Security, access control
logic, and validation
An API to do CRUD
47. The Hard Way
Lots of boilerplate DIY Security
& Privacy
Custom Node/
Python/Rails app
51. # M D B l o c a l
Demo: MongoDB Stitch
ELIOT HOROWITZ
(That’s me!)
CTO & Co-Founder
52. # M D B l o c a l
MongoDB Stitch
Introduction
DREW DI PALMA
Product Manager, Cloud
WHERE: Shard 1
WHEN: 15:55 – 15:40
Introduction to
the Stitch SDK
ADAYA COHEN
Zemingo
WHERE: Shard 2
WHEN: 11:35 – 12:15
53. # M D B l o c a l
MongoDB Stitch
Today:
- In beta
- On Atlas
Coming Soon:
- GA
- In Cloud/On Premises
54. 1 6 J A N U A RY, 2 0 1 8 | H I LT O N
# M D B l o c a l
Eliot Horowitz
CTO & Co-Founder
@eliothorowitz