Everything You Know About MongoDB is Wrong (Probably) Mark Smith - - PowerPoint PPT Presentation

everything you know about mongodb is wrong
SMART_READER_LITE
LIVE PREVIEW

Everything You Know About MongoDB is Wrong (Probably) Mark Smith - - PowerPoint PPT Presentation

Everything You Know About MongoDB is Wrong (Probably) Mark Smith | MongoDB | @Judy2K Myth 0 You think we havent seen this on YouTube @Gar1t on YouTube MongoDB is Web Scale Weve seen it. Weve bought the T-shirts. What is MongoDB?


slide-1
SLIDE 1

Everything You Know About MongoDB is Wrong

(Probably)

Mark Smith | MongoDB | @Judy2K

slide-2
SLIDE 2

You think we haven’t seen this

  • n YouTube

Myth 0

@Gar1t on YouTube

slide-3
SLIDE 3

We’ve seen it. We’ve bought the T-shirts.

MongoDB is Web Scale

slide-4
SLIDE 4

What is MongoDB?

slide-5
SLIDE 5

Database Cluster

Primary Secondary Secondary

slide-6
SLIDE 6

Documents Database Cluster

Primary Secondary Secondary {'_id': ObjectId('573a1390f29313caabcd4135'), 'title': 'Blacksmith Scene', 'fullplot': 'A stationary camera looks at a large anvil with a blacksmith behind it and one on either side.', 'cast': ['Charles Kayser', 'John Ott'], 'countries': ['USA'], 'directors': ['William K.L. Dickson'], 'genres': ['Short'], 'imdb': {'id': 5, 'rating': 6.2, 'votes': 1189}, 'released': datetime.datetime(1893, 5, 9, 0, 0), 'runtime': 1, 'year': 1893}

slide-7
SLIDE 7

Documents Database Cluster

Primary Secondary Secondary {'_id': ObjectId('573a1390f29313caabcd4135'), 'title': 'Blacksmith Scene', 'fullplot': 'A stationary camera looks at a large anvil with a blacksmith behind it and one on either side.', 'cast': ['Charles Kayser', 'John Ott'], 'countries': ['USA'], 'directors': ['William K.L. Dickson'], 'genres': ['Short'], 'imdb': {'id': 5, 'rating': 6.2, 'votes': 1189}, 'released': datetime.datetime(1893, 5, 9, 0, 0), 'runtime': 1, 'year': 1893}

slide-8
SLIDE 8

Documents Database Cluster

Primary Secondary Secondary {'_id': ObjectId('573a1390f29313caabcd4135'), 'title': 'Blacksmith Scene', 'fullplot': 'A stationary camera looks at a large anvil with a blacksmith behind it and one on either side.', 'cast': ['Charles Kayser', 'John Ott'], 'countries': ['USA'], 'directors': ['William K.L. Dickson'], 'genres': ['Short'], 'imdb': {'id': 5, 'rating': 6.2, 'votes': 1189}, 'released': datetime.datetime(1893, 5, 9, 0, 0), 'runtime': 1, 'year': 1893}

slide-9
SLIDE 9

$ sudo apt install mongodb $ mongod --version db version v2.4

MongoDB is v2.4

M y t h 1

slide-10
SLIDE 10

Google mongodb community

MongoDB is v4.4

slide-11
SLIDE 11

MongoDB is a document database

The JSON database

M y t h 2

slide-12
SLIDE 12
slide-13
SLIDE 13

MongoDB is a document database

The BSON database

slide-14
SLIDE 14

MongoDB is a BASE database

No Transactions

M y t h 3

slide-15
SLIDE 15

MongoDB is an ACID database

Yes Transactions

slide-16
SLIDE 16

You can’t have relationships between documents.

No Relationships

M y t h 4

slide-17
SLIDE 17

You totally can.

Yes Relationships

slide-18
SLIDE 18

An Aggregation Pipeline

db.orders.aggregate([{ $lookup: { from: "inventory", localField: "item", foreignField: "sku", as: "inventory_docs" } }])

slide-19
SLIDE 19

An Aggregation Pipeline

{ "_id" : 1, "item" : "almonds", "price" : 12, "quantity" : 2, "inventory_docs" : [ { "_id" : 1, "sku" : "almonds", "instock" : 120 } ] }

slide-20
SLIDE 20

A Very Simple Aggregation Pipeline

{ "_id" : 1, "item" : "almonds", "price" : 12, "quantity" : 2, "inventory_docs" : [ { "_id" : 1, "sku" : "almonds", "instock" : 120 } ] }

slide-21
SLIDE 21

That’s how you scale

MongoDB is About Sharding

M y t h 5

slide-22
SLIDE 22

Quick Sharding Primer - 2 shards

Secondary Secondary Secondary Secondary Shard Server Shard Server Primary Primary

slide-23
SLIDE 23

MongoDB can do sharding, but you probably shouldn’t

Just Buy a Bigger Machine

slide-24
SLIDE 24

We will host your database for you

Actually, use Atlas

slide-25
SLIDE 25

… isn't a thing any more

Microsharding

slide-26
SLIDE 26

… with JavaScript.

Map-Reduce

slide-27
SLIDE 27
slide-28
SLIDE 28

Aggregation Pipelines

slide-29
SLIDE 29

A Very Simple Aggregation Pipeline

db.orders.aggregate([ { $match: { status: "A" } }, { $group: { _id: "$cust_id", total: { $sum: "$amount" }}} ])

slide-30
SLIDE 30

A Very Simple Aggregation Pipeline

db.orders.aggregate([ { $match: { status: "A" } }, { $group: { _id: "$cust_id", total: { $sum: "$amount" }}} ])

slide-31
SLIDE 31

A Very Simple Aggregation Pipeline

db.orders.aggregate([ { $match: { status: "A" } }, { $group: { _id: "$cust_id", total: { $sum: "$amount" }}} ])

slide-32
SLIDE 32

Haven’t there been breaches?

MongoDB is Insecure

M y t h 6

slide-33
SLIDE 33

Industry-standard security. Bad defaults have been fixed.

MongoDB is Secure

slide-34
SLIDE 34

… doesn’t it?

MongoDB Loses Data

M y t h 7

slide-35
SLIDE 35

… but we used to have some silly defaults

MongoDB Is Durable

slide-36
SLIDE 36

Primary Secondary Secondary

Database Cluster

slide-37
SLIDE 37

Well … yes … and no.

MongoDB is Really Easy

M y t h 8

slide-38
SLIDE 38

https://bit.ly/mongodb-covid

COVID-19 Open Data

slide-39
SLIDE 39

Everything You Know About MongoDB is Wrong

(Probably)

Mark Smith | MongoDB | @Judy2K

Some stuff Right

slide-40
SLIDE 40

Thank you

That’s all folks

Mark Smith | MongoDB | @Judy2k