3. Introduction
• Loose Outline
• JSON Document
• Collections
• Different APIs
• Python
• REST
• SQL
• .NET/LINQ
• Not available in all regions
• Central US, West US, North Europe, West Europe
4. JSON Document
• Standard for passing data between a server and a web application
• Replacement for XML
• Hierarchical
• Terse
• Simple data types
7. Database
Account
A database account is associated with one or more capacity units representing
provisioned document storage and throughput, a set of databases and blob storage.
You can create one or more database accounts using your Azure subscription. Each
database account has a unique DNS name.
Database A database is a logical container of document storage partitioned across collections.
Collection A collection is a container of JSON documents and associated JavaScript application
logic. Queries and transactions are scoped to collections.
8.
9. DocumentDB Limits
• Max Document Size – 512K
• DocumentDB Account – 100 databases per account * 10GB each =
1TB
14. Modeling Data - RDBMS
SELECT p.FirstName, p.LastName, a.City, cd.Detail
FROM Person p
JOIN ContactDetail cd
ON cd.PersonId = p.Id
JOIN ContactDetailType on cdt
ON cdt.Id = cd.TypeId
JOIN Address a
ON a.PersonId = p.Id
15. Modeling in DocumentDB
{
"id": "1",
"firstName": "Thomas",
"lastName": "Andersen",
"addresses": [
{
"line1": "100 Some Street",
"line2": "Unit 1",
"city": "Seattle",
"state": "WA",
"zip": 98012
}
],
"contactDetails": [
{"email: "thomas@andersen.com"},
{"phone": "+1 555 555-5555", "extension": 5555}
]
}
Reading is one operation
Writing is one operation
No assembly de-assembly
16. When to embed
• There are contains relationships between entities.
• There are one-to-few relationships between entities.
• There is embedded data that changes infrequently.
• There is embedded data won't grow without bound.
• There is embedded data that is integral to data in a document.
Examples of when not to embed
• Like a blog post comments or customer orders for the enterprise
20. Consistency
Consistency Level Description TradeOff
Strong a write is only visible after it is
committed durably by the majority
quorum of replicas
Absolute guarantees on data
consistency, but offers the lowest level
of read and write performance.
Bounded staleness a write is only visible after it is
committed durably by the majority
quorum of replicas
more predictable behavior for read
consistency while offering the lowest
latency writes
Session ability to read your own writes. . A
read request for session consistency is
issued against a replica that can serve
the client requested version (part of
the session cookie).
predictable read data consistency for a
session while offering the lowest
latency writes. Reads are also low
latency as except in the rare cases, the
read will be served by a single replica.
Eventual Eventual consistency is the weakest
form of consistency wherein a client
may get the values which are older
than the ones it had seen before
the weakest read consistency but
offers the lowest latency for both reads
and writes
21. Indexing
• Everything is indexed by default
• Opt-in or out at collection creation
• Range – Good for numbers that need where filters with >=, >, <, <=
• Hash – Good for strings
22. Ike Ellis
• Crafting Bytes
• Small Software Studio
• Modern web, mobile, Azure, SQL Server
• Looking for future teammates!
• Book: Developing Azure Solutions
• www.craftingbytes.com
• blog.ikeellis.com
• www.ikeellis.com
• Ike Ellis, MVP
• @ike_ellis
• 619.922.9801
• ike@craftingbytes.com