14. Key-Value Store Column Family Document Store Graph
Azure
DocumentDB
Azure
Table
Storage
Amazon
DynamoDB
Multimodel
15. http://www.martinfowler.com/articles/microservices.html
Monolithic applications prefer a
single logical database for persistent
data. This DB becomes an integration
DB as well as reporting DB.
Microservices prefer letting each
service manage its own database,
either different instances of the same
database technology, or entirely
different database systems - an
approach called Polyglot Persistence.
17. http://blog.nahurst.com/visual-guide-to-nosql-systems
PACELC
if there is a partition (P), how
does the system trade off
availability and consistency (A
and C); else (E), when the system
is running normally in the
absence of partitions, how does
the system trade off latency (L)
and consistency (C)?
PA/EL:
Dynamo, Cassandra, Riak
PA/EC:
MongoDB
PC/EC:
VoltDB, HBase
30. ID:1040, Total: 310.00
Part
808082
723093
Qty
2
7
Price
50.5
30.0
Total
101
210
Line Items
Payment Detail
Card Number: 2929 xxxx 3939
Expiry: Jan, 2018
Scheme: Visa
Customer
CustomerID: 19281
Name: Ann Marie
Email: ann.marie@gmail.com
ID CustomerID Total
1040 19281 310
ID Name Email
19281
OrderID CC Expiry Scheme
1040 xxxx Jan Visa
Orders
Customers
OrderLines
PaymentDetails
OrderID Line Qty Price
1040 1 2 50.5
Order
Aggregate is
a pattern in
Domain-
Driven
Design. A
DDD
aggregate is
a cluster of
domain
objects that
can be
treated as a
single unit.
31. JSON (JavaScript Object Notation) is a lightweight data-
interchange format.
It is easy for humans to read and write. It is easy for
machines to parse and generate.
It is based on a subset of the JavaScript Programming
Language, Standard ECMA-262 3rd Edition - December
1999.
JSON is a text format that is completely language
independent JSON is built on two structures:
• A collection of name/value pairs. In various languages,
this is realized as an object, record, struct, dictionary,
hash table, keyed list, or associative array.
• An ordered list of values. In most languages, this is
realized as an array, vector, list, or sequence.
{
"_id" : "585724eedd76957cf32baaf2",
"title" : "Ms",
"firstName" : "Leigh",
"surname" : "Nielsen",
"age" : 33,
"gender" : "female",
"address" : [
{
"line1" : "705 Anna Court",
"city" : "Thermal",
"state" : "Utah",
"zip" : 2584
},
{
"line1" : "833 Sands Street",
"city" : "Eden",
"state" : "Texas",
"zip" : 5603
}
]
}
32. RDBMS Document Oriented DBs
Database Database
Table Collection
Row Document
Columns Document fields
Index Index
Join Embedded document or reference, $lookup op (v3.2)
View Read only views (v3.4)
Primary Key “_id” field of the document (Auto-generated 12 byte type unique within
collection. Can be manually assigned as well. Can be composite)
34. SQL Document Oriented DBs
SELECT / WHERE db.<collection>.find({match}, {project}), $or $and $exists operators
ORDER BY db.<collection>.find({}, {}).sort({sort object})
LIMIT / SKIP db.<collection>.find({}, {}).limit(n).skip(m)
GROUP BY Aggregation Pipeline and Map-Reduce
JOIN $lookup operator
INSERT db.<collection>.insert({doc})
UPDATE db.<collection>.update({match},{doc}), $set & $unset op
DELETE db.<collection>.remove({match})
CREATE INDEX db.<collection>.createIndex({index object})
VIEW db.createView(<view>, <source>, <pipeline>, <collation> )
Explain Plan db.<collection>.find({}, {}).explain()
35.
36. Issue Link
MongoDB performance issues when used for
OLAP/DW queries
https://www.8kdata.com/blog/the-conundrum-
of-bi-aggregate-queries-on-mongodb/
MongoDB queries don’t always return all matching
documents!
http://blog.couchbase.com/2016/july/testing-
mongodb-and-couchbase-concurrent-query
https://www.linkedin.com/pulse/mongodb-
frankenstein-monster-nosql-databases-john-de-
goes?trk=mp-reader-card
MongoDB 3.2: Now Powered by PostgreSQL https://www.linkedin.com/pulse/mongodb-32-
now-powered-postgresql-john-de-goes?trk=mp-
reader-card
MongoDB stale reads https://aphyr.com/posts/322-jepsen-mongodb-
stale-reads
Collection = Logical Container
Partition = Physical Container, up to 10GB, online auto partitioning, transactions scoped to partition key, sny path in a JSON doc can be made a partioon key