Slide 1

Slide 1 text

An introduction to NoSQL & MongoDB Prepared by Justin J. Moses for Fullstack & Grace Hopper Academy August 2016

Slide 2

Slide 2 text

Hey there, I’M JUSTIN I’m an engineer at MongoDB, leading the web team for our Cloud products. You can find me at: @justinjmoses

Slide 3

Slide 3 text

WHAT IS NoSQL? deconstructing the lingo

Slide 4

Slide 4 text

What is NoSQL? ✘ Databases without inherent relations ✘ Easier to distribute data across nodes (horizontal scaling) without relations ✘ Mostly schema-free ✘ Typically geared towards read performance (i.e. free of joins) ✘ Examples include CouchDB, Cassandra, Couchbase, MarkLogic & of course, MongoDB

Slide 5

Slide 5 text

The CAP theorem

Slide 6

Slide 6 text

& MongoDB? The database you learn to love

Slide 7

Slide 7 text

A brief history on MongoDB Started in 2007 Back then it was just a part of 10gen’s platform as a service they were creating A happy accident The database became more popular than the platform, such that the company eventually rebranded to MongoDB. humongous The name comes from the word “humongous”, implying the built-in tools to help scale up quickly

Slide 8

Slide 8 text

What’s inside the box? JSON (BSON) Stores data as binary-JSON, meaning it’s the using same format as your app’s REST API Schema Free Instead of defining a schema upfront, it is inferred from the state of the documents within the collection Upsertion Follows the FP philosophy of nullable types - that is either insert or update in one fell swoop - databases, collections and even documents. High Availability Introduces the concept of a Replica Set: a primary node replicating data to any number of secondaries. If the primary goes down, a secondary will take its place. Scaling Support Provides load balancing via the creation of sharding. That is, balancing data across various nodes and sending each query to the appropriate node. Aggregation Boasts a powerful aggregation pipeline, to funnel your data through composable transformers..

Slide 9

Slide 9 text

Learning to speak Mongo SQL Terms/Concepts MongoDB Terms/Concepts database database table collection record document column field join embedded document ID Object ID

Slide 10

Slide 10 text

How might a Mongo schema compare to a relational one?

Slide 11

Slide 11 text

No content

Slide 12

Slide 12 text

denormalization Duplicating data to optimize for reads

Slide 13

Slide 13 text

Pros Without the need for complicated joins, reads are simple & fast. Ins & outs of denormalization Cons Updates are more cumbersome (mutate multiple documents) and data may become invalid.

Slide 14

Slide 14 text

So what’s missing from Mongo? Features on our roadmap

Slide 15

Slide 15 text

joins you have to do them yourself views persistent queries transactions cannot guarantee multiple insertions occur atomically

Slide 16

Slide 16 text

So let’s dive right in...

Slide 17

Slide 17 text

Drivers How to connect to Mongo via your apps

Slide 18

Slide 18 text

Cloud Management ...looking after production deploys

Slide 19

Slide 19 text

thanks! ANY QUESTIONS? @justinjmoses