More aggregation functions
$sample
> db.mycoll.aggregate({ $sample: { size: 100 } })
<5% data: Random cursor or index selection
>=5% data: Scan entire collection, sort randomly in memory,
fetch documents from the top
Had MongoDB really done
the impossible? Had they
developed a connector
which satisfies all the
requirements of NoSQL
analytics,...
Slide 42
Slide 42 text
but exposes relational
semantics on flat, uniform
data, so legacy BI
software can handle it?
— https://www.linkedin.com/pulse/mongodb-32-
now-powered-postgresql-john-de-goes
Slide 43
Slide 43 text
MongoDB had gone from
nothing to magic in just a
few months [?]
— https://www.linkedin.com/pulse/mongodb-32-
now-powered-postgresql-john-de-goes
Slide 44
Slide 44 text
It uses a foreign data
wrapper with PostgreSQL
to provide a relational
SQL view into your
MongoDB data.
— https://docs.mongodb.org/manual/products/bi-
connector/
Slide 45
Slide 45 text
"Shit. This is bad news for
MongoDB. Really bad."
— https://www.linkedin.com/pulse/mongodb-32-
now-powered-postgresql-john-de-goes
Slide 46
Slide 46 text
Storage
Engines
Slide 47
Slide 47 text
MongoDB is webscale
Slide 48
Slide 48 text
Pluggable storage engine
in 3.0
MMAPv1 and WiredTiger
Slide 49
Slide 49 text
Structure
B-Tree
LSM-Tree
Fractal-Tree
Slide 50
Slide 50 text
MMAPv1
Default before 3.2
OS provides memory mapped files
B-Tree
Slide 51
Slide 51 text
MMAPv1
Collection-level locking
Documents a single block
Slide 52
Slide 52 text
WiredTiger
Default in 3.2
Currently B-Tree
Maybe LSM-Tree in the future
Slide 53
Slide 53 text
WiredTiger
Compression
Document-level locking
Index prefix compression
Slide 54
Slide 54 text
WiredTiger Experience
Much faster inserts
Watch out for
storage.wiredTiger.engineConfig.cacheSizeGB
max(1GB, 60%-1GB)
Slide 55
Slide 55 text
Enterprise Feature
Encrypted Storage Engine
Slide 56
Slide 56 text
Enterprise Feature
In-Memory Storage
Engine
Currently in Beta
Slide 57
Slide 57 text
Percona
RocksDB and PerconaFT
Slide 58
Slide 58 text
Config
Servers as
Replica Sets
Slide 59
Slide 59 text
Before 3.2
Exactly 3 independent config servers
Read and write with 3 available nodes
Read-only with less
Slide 60
Slide 60 text
With 3.2
Can be a replica set
With up to 50 members