SlideShare uma empresa Scribd logo
1 de 27
DocumentDB
NoSQL the sequel
Hvem er jeg?
christian@dotnetnerd.dk
www.dotnetnerd.dk
@dotnetnerd
Agenda
• Hvor passer DocumentDB ind?
• Arkitektur
• Tooling
• REST API / SDK’er
Data på Azure
• SQL
• Storage (blob, table, file, queue)
• Redis Cache
• Search
• DocumentDB
Dokumentdatabaser
• Ingen schema
• Json
• Nestede komplekse datastrukturer
• Advancerede query muligheder
• Matcher godt med objektmodeller
Hvordan adskiller DocumentDB sig?
• Bygget til cloud
• Elasticitet
• High availability
• Velkendte begreber fra SQL
• SQL
• Stored procedures
• Triggers
• User-defined functions
Ressourcer
{Json}
Property User settable or system
generated?
Purpose
_rid System generated System generated, unique
and hierarchical identifier of
the resource.
_etag System generated etag of the resource
required for optimistic
concurrency control.
_ts System generated Last updated timestamp of
the resource.
_self System generated Unique addressable URI of
the resource.
id User settable User defined unique name
of the resource.
Datatyper
• Json.NET serializer
• Datoer som ISO 8601 string
Database
Brugere og rettigheder
• Account administrators
• Read-only administrators
• Database users and permissions
• Manuelt styre adgang til resources
• All / read
var docUser = new User { Id = "mobileuser" };
docUser = await client.CreateUserAsync(database.SelfLink, docUser);
var docPermission = new Permission
{
PermissionMode = PermissionMode.Read,
ResourceLink = documentCollection.SelfLink,
Id = "readperm"
};
docPermission = await client.CreatePermissionAsync(docUser.SelfLink, docPermission);
FeedResponse<Permission> permFeed = await client.ReadPermissionFeedAsync(docUser.SelfLink);
List<Permission> permList = new List<Permission>();
foreach (Permission perm in permFeed)
{
permList.Add(perm);
}
DocumentClient userClient = new DocumentClient(new Uri(endpointUrl),permList);
Consistency levels
• Strong – quorum writes og reads. Forespørgsler er fuldt konsistente.
• Bounded Staleness – write order er konsistent. Reads må være bagud
med et specificeret antal operationer (eller tid i sekunder).
• Session - write order og reads er konsistente inden for en client
session.
• Eventual – reads må være ude af sekvens, eg., nogle reads ser
muligvis ikke de seneste ændringer
Collections
• Container til Json dokumenter
• En collection kan indeholde forskellige typer dokumenter
• Sharding og fan-out queries
• Skaleringsenhed for transaktioner og queries
• Konfigurerbar indexering
Indexing
• Automatic
• Kan slås fra (kun query på id og selflink)
• Query med FeedOptions.EnableScanInQuery
• Tilføj eller fjern enkelte dokumenter (whitelist/blacklist)
client.CreateDocumentAsync(defaultCollection.SelfLink,
new { Name = ”Christian", isSpeaking = true },
new RequestOptions
{
IndexingDirective = IndexingDirective.Include
}
);
Indexing modes
• Consistent
• Lazy (= eventual consistency level)
var defaultCollection = new DocumentCollection { Name ="defaultCollection" };
defaultCollection.IndexingPolicy.Automatic = true;
// Set IndexingMode to Lazy for bulk import/read heavy collections.
defaultCollection.IndexingPolicy.IndexingMode = IndexingMode.Lazy;
defaultCollection = await client.CreateDocumentCollectionAsync(database.SelfLink,defaultCollection);
Skalering og pris
• Capacity units
• SSD storage og throughput
Tools
• Azure Portal
• DocumentDBStudio (github)
• Visual Studio (roadmap)
• Azure DocumentDB Data
Migration Tool (github)
• Json
• MongoDB
• SQL Server
• CSV
REST API
VALUE OF THE _SELF DESCRIPTION
/dbs Feed of databases under a database account.
/dbs/{_rid-db}
Database with the unique id property with
the value {_rid-db}.
/dbs/{_rid-db}/colls/ Feed of collections under a database.
/dbs/{_rid-db}/colls/{_rid-coll}
Collection with the unique id property with
the value {_rid-coll}.
/dbs/{_rid-db}/users/ Feed of users under a database.
/dbs/{_rid-db}/users/{_rid-user}
User with the unique id property with the
value {_rid-user}.
/dbs/{_rid-db}/users/{_rid-user}/permissions Feed of permissions under a database.
/dbs/{_rid-db}/users/{_rid-
user}/permissions/{_rid-permission}
Permission with the unique id property with
the value {_rid-permission}.
POST https://mydb.documents.azure.com/dbs/XP0mAA==/colls/XP0mAJ3H-AA=/docs HTTP/1.1
x-ms-documentdb-isquery: True
x-ms-date: Mon, 18 Aug 2014 13:05:49 GMT
authorization: type%3dmaster%26ver%3d1.0%26sig%3dkOU%2bBn2vkvIlHypfE8AA5fulpn8zKjLwdrxBqyg0YGQ%3d
x-ms-version: 2014-08-21
Accept: application/json
Content-Type: application/query+json
Host: mydb.documents.azure.com
Content-Length: 50
{
query: "SELECT * FROM root WHERE (root.Person.id = 'Jens')",
parameters: []
}
SDK’er
• Dokumentation og samples:
• http://azure.microsoft.com/da-dk/documentation/services/documentdb
• https://code.msdn.microsoft.com/windowsazure/Azure-DocumentDB-NET-Code-6b3da8af
• .NET (Nuget)
• LINQ
• Java
• Python
• Node
• JavaScript (database)
.NET SDK
• Nuget
• Client
• Database
• Collection
• Selflinks
Performance
• Én client i applikationens levetid
• Cache selflinks
• Call client.OpenAsync()
• ConnectionMode (gateway/direct)
• Protocol (https/tcp)
new DocumentClient(new Uri(MyEndPointUrl), MyAuthorizationKey, new ConnectionPolicy()
{
ConnectionMode = ConnectionMode.Direct,
ConnectionProtocol = Protocol.Tcp
});
Queries
• SQL
• Parameters
• LINQ
• Forskellige typer i samme collection
• Ingen Skip, Top, Count…
SELECT
f.id AS familyName,
c.givenName AS childGivenName,
c.firstName AS childFirstName,
p.givenName AS petName
FROM Families f
JOIN c IN f.children
JOIN p IN c.pets
WHERE p.givenName = "King"
User-defined functions
• JavaScript
• Opret som ressource
• Brug fra Queries
var udf = new UserDefinedFunction
{
Id = "myUdf",
Body = udfBody,
};
await client.CreateUserDefinedFunctionAsync(colSelfLink, udf);
Triggers
• JavaScript
• Opret som ressource
• Specificeres ved operation
var triggerId = "myTrigger";
Trigger trigger = new Trigger
{
Id = triggerId,
Body = triggerBody,
TriggerOperation = TriggerOperation.Create,
TriggerType = TriggerType.Post //Pre or Post
};
await client.CreateTriggerAsync(colSelfLink, trigger);
var requestOptions = new RequestOptions {
PostTriggerInclude = new List<string> { triggerId }
};
await client.CreateDocumentAsync(colSelfLink, myDocument,
requestOptions);
Stored procedures
• JavaScript
• Opret som ressource
• Execute
• Tidsgrænse
await _client.CreateStoredProcedureAsync(colSelfLink,
new StoredProcedure()
{
Id = "mySproc",
Body = sprocBody
});
var sproc = _client.CreateStoredProcedureQuery(colSelfLink)
.ToList().Single(sp => sp.Id == "mySproc");
var sprocResponse =
await _client.ExecuteStoredProcedureAsync<int>(sproc.SelfLink, objData);
Transaktioner
• Dybt integrerede i javascript modellen
• Funktion = ACID transaktion med snapshot isolation
• Exception => rollback
Takeaways
• Dokumentdatabaser
• Forståelse for arkitekturen
• Overblik over tooling og sdk’er
• Mod på at bruge DocumentDB

Mais conteúdo relacionado

Mais procurados

Azure document db
Azure document dbAzure document db
Azure document dbIan Chen
 
Azure DocumentDB 101
Azure DocumentDB 101Azure DocumentDB 101
Azure DocumentDB 101Ike Ellis
 
Discover MongoDB - Israel
Discover MongoDB - IsraelDiscover MongoDB - Israel
Discover MongoDB - IsraelMichael Fiedler
 
Cool NoSQL on Azure with DocumentDB
Cool NoSQL on Azure with DocumentDBCool NoSQL on Azure with DocumentDB
Cool NoSQL on Azure with DocumentDBJan Hentschel
 
CosmosDb for beginners
CosmosDb for beginnersCosmosDb for beginners
CosmosDb for beginnersPhil Pursglove
 
Why MongoDB over other Databases - Habilelabs
Why MongoDB over other Databases - HabilelabsWhy MongoDB over other Databases - Habilelabs
Why MongoDB over other Databases - HabilelabsHabilelabs
 
Azure sql database limitations
Azure sql database limitationsAzure sql database limitations
Azure sql database limitationsBRIJESH KUMAR
 
Introduction to azure cosmos db
Introduction to azure cosmos dbIntroduction to azure cosmos db
Introduction to azure cosmos dbRatan Parai
 
Azure doc db (slideshare)
Azure doc db (slideshare)Azure doc db (slideshare)
Azure doc db (slideshare)David Green
 
A Presentation on MongoDB Introduction - Habilelabs
A Presentation on MongoDB Introduction - HabilelabsA Presentation on MongoDB Introduction - Habilelabs
A Presentation on MongoDB Introduction - HabilelabsHabilelabs
 
Azure CosmosDB the new frontier of big data and nosql
Azure CosmosDB the new frontier of big data and nosqlAzure CosmosDB the new frontier of big data and nosql
Azure CosmosDB the new frontier of big data and nosqlRiccardo Cappello
 
Introduction à DocumentDB
Introduction à DocumentDBIntroduction à DocumentDB
Introduction à DocumentDBMSDEVMTL
 
Introduction to Azure DocumentDB
Introduction to Azure DocumentDBIntroduction to Azure DocumentDB
Introduction to Azure DocumentDBDenny Lee
 
From SQL to MongoDB
From SQL to MongoDBFrom SQL to MongoDB
From SQL to MongoDBNuxeo
 
https://docs.google.com/presentation/d/1DcL4zK6i3HZRDD4xTGX1VpSOwyu2xBeWLT6a_...
https://docs.google.com/presentation/d/1DcL4zK6i3HZRDD4xTGX1VpSOwyu2xBeWLT6a_...https://docs.google.com/presentation/d/1DcL4zK6i3HZRDD4xTGX1VpSOwyu2xBeWLT6a_...
https://docs.google.com/presentation/d/1DcL4zK6i3HZRDD4xTGX1VpSOwyu2xBeWLT6a_...MongoDB
 
Session #2, tech session: Build realtime search by Sylvain Utard from Algolia
Session #2, tech session: Build realtime search by Sylvain Utard from AlgoliaSession #2, tech session: Build realtime search by Sylvain Utard from Algolia
Session #2, tech session: Build realtime search by Sylvain Utard from AlgoliaSaaS Is Beautiful
 

Mais procurados (20)

Azure document db
Azure document dbAzure document db
Azure document db
 
Azure DocumentDB 101
Azure DocumentDB 101Azure DocumentDB 101
Azure DocumentDB 101
 
Discover MongoDB - Israel
Discover MongoDB - IsraelDiscover MongoDB - Israel
Discover MongoDB - Israel
 
Cool NoSQL on Azure with DocumentDB
Cool NoSQL on Azure with DocumentDBCool NoSQL on Azure with DocumentDB
Cool NoSQL on Azure with DocumentDB
 
CosmosDb for beginners
CosmosDb for beginnersCosmosDb for beginners
CosmosDb for beginners
 
Why MongoDB over other Databases - Habilelabs
Why MongoDB over other Databases - HabilelabsWhy MongoDB over other Databases - Habilelabs
Why MongoDB over other Databases - Habilelabs
 
Azure sql database limitations
Azure sql database limitationsAzure sql database limitations
Azure sql database limitations
 
Introduction to azure cosmos db
Introduction to azure cosmos dbIntroduction to azure cosmos db
Introduction to azure cosmos db
 
Azure DocumentDB
Azure DocumentDBAzure DocumentDB
Azure DocumentDB
 
Azure doc db (slideshare)
Azure doc db (slideshare)Azure doc db (slideshare)
Azure doc db (slideshare)
 
A Presentation on MongoDB Introduction - Habilelabs
A Presentation on MongoDB Introduction - HabilelabsA Presentation on MongoDB Introduction - Habilelabs
A Presentation on MongoDB Introduction - Habilelabs
 
Azure CosmosDb
Azure CosmosDbAzure CosmosDb
Azure CosmosDb
 
Azure CosmosDB the new frontier of big data and nosql
Azure CosmosDB the new frontier of big data and nosqlAzure CosmosDB the new frontier of big data and nosql
Azure CosmosDB the new frontier of big data and nosql
 
NOSQL vs SQL
NOSQL vs SQLNOSQL vs SQL
NOSQL vs SQL
 
Introduction à DocumentDB
Introduction à DocumentDBIntroduction à DocumentDB
Introduction à DocumentDB
 
Introduction to Azure DocumentDB
Introduction to Azure DocumentDBIntroduction to Azure DocumentDB
Introduction to Azure DocumentDB
 
From SQL to MongoDB
From SQL to MongoDBFrom SQL to MongoDB
From SQL to MongoDB
 
https://docs.google.com/presentation/d/1DcL4zK6i3HZRDD4xTGX1VpSOwyu2xBeWLT6a_...
https://docs.google.com/presentation/d/1DcL4zK6i3HZRDD4xTGX1VpSOwyu2xBeWLT6a_...https://docs.google.com/presentation/d/1DcL4zK6i3HZRDD4xTGX1VpSOwyu2xBeWLT6a_...
https://docs.google.com/presentation/d/1DcL4zK6i3HZRDD4xTGX1VpSOwyu2xBeWLT6a_...
 
Microsoft azure documentDB
Microsoft azure documentDBMicrosoft azure documentDB
Microsoft azure documentDB
 
Session #2, tech session: Build realtime search by Sylvain Utard from Algolia
Session #2, tech session: Build realtime search by Sylvain Utard from AlgoliaSession #2, tech session: Build realtime search by Sylvain Utard from Algolia
Session #2, tech session: Build realtime search by Sylvain Utard from Algolia
 

Semelhante a Document db

Azure SQL Database
Azure SQL Database Azure SQL Database
Azure SQL Database nj-azure
 
Azure DocumentDB for Healthcare Integration
Azure DocumentDB for Healthcare IntegrationAzure DocumentDB for Healthcare Integration
Azure DocumentDB for Healthcare IntegrationBizTalk360
 
MongoDB & NoSQL 101
 MongoDB & NoSQL 101 MongoDB & NoSQL 101
MongoDB & NoSQL 101Jollen Chen
 
Azure - Data Platform
Azure - Data PlatformAzure - Data Platform
Azure - Data Platformgiventocode
 
Microsoft Azure DocumentDB - Global Azure Bootcamp 2016
Microsoft Azure DocumentDB -  Global Azure Bootcamp 2016Microsoft Azure DocumentDB -  Global Azure Bootcamp 2016
Microsoft Azure DocumentDB - Global Azure Bootcamp 2016Sunny Sharma
 
TechEd AU 2014: Microsoft Azure DocumentDB Deep Dive
TechEd AU 2014: Microsoft Azure DocumentDB Deep DiveTechEd AU 2014: Microsoft Azure DocumentDB Deep Dive
TechEd AU 2014: Microsoft Azure DocumentDB Deep DiveIntergen
 
Best practices on Building a Big Data Analytics Solution (SQLBits 2018 Traini...
Best practices on Building a Big Data Analytics Solution (SQLBits 2018 Traini...Best practices on Building a Big Data Analytics Solution (SQLBits 2018 Traini...
Best practices on Building a Big Data Analytics Solution (SQLBits 2018 Traini...Michael Rys
 
Share point 2010 performance and capacity planning best practices
Share point 2010 performance and capacity planning best practicesShare point 2010 performance and capacity planning best practices
Share point 2010 performance and capacity planning best practicesEric Shupps
 
More Cache for Less Cash (DevLink 2014)
More Cache for Less Cash (DevLink 2014)More Cache for Less Cash (DevLink 2014)
More Cache for Less Cash (DevLink 2014)Michael Collier
 
Accesso ai dati con Azure Data Platform
Accesso ai dati con Azure Data PlatformAccesso ai dati con Azure Data Platform
Accesso ai dati con Azure Data PlatformLuca Di Fino
 
AWS CLOUD 2017 - Amazon Athena 및 Glue를 통한 빠른 데이터 질의 및 처리 기능 소개 (김상필 솔루션즈 아키텍트)
AWS CLOUD 2017 - Amazon Athena 및 Glue를 통한 빠른 데이터 질의 및 처리 기능 소개 (김상필 솔루션즈 아키텍트)AWS CLOUD 2017 - Amazon Athena 및 Glue를 통한 빠른 데이터 질의 및 처리 기능 소개 (김상필 솔루션즈 아키텍트)
AWS CLOUD 2017 - Amazon Athena 및 Glue를 통한 빠른 데이터 질의 및 처리 기능 소개 (김상필 솔루션즈 아키텍트)Amazon Web Services Korea
 
Lessons from the Trenches - Building Enterprise Applications with RavenDB
Lessons from the Trenches - Building Enterprise Applications with RavenDBLessons from the Trenches - Building Enterprise Applications with RavenDB
Lessons from the Trenches - Building Enterprise Applications with RavenDBOren Eini
 
Elastic search intro-@lamper
Elastic search intro-@lamperElastic search intro-@lamper
Elastic search intro-@lampermedcl
 

Semelhante a Document db (20)

Azure cosmosdb
Azure cosmosdbAzure cosmosdb
Azure cosmosdb
 
CosmosDB.pptx
CosmosDB.pptxCosmosDB.pptx
CosmosDB.pptx
 
Azure SQL Database
Azure SQL Database Azure SQL Database
Azure SQL Database
 
Azure DocumentDB for Healthcare Integration
Azure DocumentDB for Healthcare IntegrationAzure DocumentDB for Healthcare Integration
Azure DocumentDB for Healthcare Integration
 
MongoDB & NoSQL 101
 MongoDB & NoSQL 101 MongoDB & NoSQL 101
MongoDB & NoSQL 101
 
Azure - Data Platform
Azure - Data PlatformAzure - Data Platform
Azure - Data Platform
 
Microsoft Azure DocumentDB - Global Azure Bootcamp 2016
Microsoft Azure DocumentDB -  Global Azure Bootcamp 2016Microsoft Azure DocumentDB -  Global Azure Bootcamp 2016
Microsoft Azure DocumentDB - Global Azure Bootcamp 2016
 
TechEd AU 2014: Microsoft Azure DocumentDB Deep Dive
TechEd AU 2014: Microsoft Azure DocumentDB Deep DiveTechEd AU 2014: Microsoft Azure DocumentDB Deep Dive
TechEd AU 2014: Microsoft Azure DocumentDB Deep Dive
 
Best practices on Building a Big Data Analytics Solution (SQLBits 2018 Traini...
Best practices on Building a Big Data Analytics Solution (SQLBits 2018 Traini...Best practices on Building a Big Data Analytics Solution (SQLBits 2018 Traini...
Best practices on Building a Big Data Analytics Solution (SQLBits 2018 Traini...
 
Share point 2010 performance and capacity planning best practices
Share point 2010 performance and capacity planning best practicesShare point 2010 performance and capacity planning best practices
Share point 2010 performance and capacity planning best practices
 
More Cache for Less Cash (DevLink 2014)
More Cache for Less Cash (DevLink 2014)More Cache for Less Cash (DevLink 2014)
More Cache for Less Cash (DevLink 2014)
 
DOTNET8.pptx
DOTNET8.pptxDOTNET8.pptx
DOTNET8.pptx
 
Accesso ai dati con Azure Data Platform
Accesso ai dati con Azure Data PlatformAccesso ai dati con Azure Data Platform
Accesso ai dati con Azure Data Platform
 
An intro to Azure Data Lake
An intro to Azure Data LakeAn intro to Azure Data Lake
An intro to Azure Data Lake
 
mongodb_DS.pptx
mongodb_DS.pptxmongodb_DS.pptx
mongodb_DS.pptx
 
Elasticsearch Introduction at BigData meetup
Elasticsearch Introduction at BigData meetupElasticsearch Introduction at BigData meetup
Elasticsearch Introduction at BigData meetup
 
AWS CLOUD 2017 - Amazon Athena 및 Glue를 통한 빠른 데이터 질의 및 처리 기능 소개 (김상필 솔루션즈 아키텍트)
AWS CLOUD 2017 - Amazon Athena 및 Glue를 통한 빠른 데이터 질의 및 처리 기능 소개 (김상필 솔루션즈 아키텍트)AWS CLOUD 2017 - Amazon Athena 및 Glue를 통한 빠른 데이터 질의 및 처리 기능 소개 (김상필 솔루션즈 아키텍트)
AWS CLOUD 2017 - Amazon Athena 및 Glue를 통한 빠른 데이터 질의 및 처리 기능 소개 (김상필 솔루션즈 아키텍트)
 
Lessons from the Trenches - Building Enterprise Applications with RavenDB
Lessons from the Trenches - Building Enterprise Applications with RavenDBLessons from the Trenches - Building Enterprise Applications with RavenDB
Lessons from the Trenches - Building Enterprise Applications with RavenDB
 
Mongo DB
Mongo DB Mongo DB
Mongo DB
 
Elastic search intro-@lamper
Elastic search intro-@lamperElastic search intro-@lamper
Elastic search intro-@lamper
 

Último

WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...
WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...
WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...WSO2
 
%in Benoni+277-882-255-28 abortion pills for sale in Benoni
%in Benoni+277-882-255-28 abortion pills for sale in Benoni%in Benoni+277-882-255-28 abortion pills for sale in Benoni
%in Benoni+277-882-255-28 abortion pills for sale in Benonimasabamasaba
 
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital TransformationWSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital TransformationWSO2
 
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...masabamasaba
 
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...Bert Jan Schrijver
 
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...WSO2
 
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyviewmasabamasaba
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...Health
 
Announcing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK SoftwareAnnouncing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK SoftwareJim McKeeth
 
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...SelfMade bd
 
WSO2CON 2024 Slides - Open Source to SaaS
WSO2CON 2024 Slides - Open Source to SaaSWSO2CON 2024 Slides - Open Source to SaaS
WSO2CON 2024 Slides - Open Source to SaaSWSO2
 
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfonteinmasabamasaba
 
Artyushina_Guest lecture_YorkU CS May 2024.pptx
Artyushina_Guest lecture_YorkU CS May 2024.pptxArtyushina_Guest lecture_YorkU CS May 2024.pptx
Artyushina_Guest lecture_YorkU CS May 2024.pptxAnnaArtyushina1
 
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park %in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park masabamasaba
 
WSO2Con204 - Hard Rock Presentation - Keynote
WSO2Con204 - Hard Rock Presentation - KeynoteWSO2Con204 - Hard Rock Presentation - Keynote
WSO2Con204 - Hard Rock Presentation - KeynoteWSO2
 
WSO2CON 2024 - API Management Usage at La Poste and Its Impact on Business an...
WSO2CON 2024 - API Management Usage at La Poste and Its Impact on Business an...WSO2CON 2024 - API Management Usage at La Poste and Its Impact on Business an...
WSO2CON 2024 - API Management Usage at La Poste and Its Impact on Business an...WSO2
 
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...chiefasafspells
 
tonesoftg
tonesoftgtonesoftg
tonesoftglanshi9
 
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfonteinmasabamasaba
 
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...masabamasaba
 

Último (20)

WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...
WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...
WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...
 
%in Benoni+277-882-255-28 abortion pills for sale in Benoni
%in Benoni+277-882-255-28 abortion pills for sale in Benoni%in Benoni+277-882-255-28 abortion pills for sale in Benoni
%in Benoni+277-882-255-28 abortion pills for sale in Benoni
 
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital TransformationWSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
 
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
 
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
 
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
 
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
 
Announcing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK SoftwareAnnouncing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK Software
 
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
 
WSO2CON 2024 Slides - Open Source to SaaS
WSO2CON 2024 Slides - Open Source to SaaSWSO2CON 2024 Slides - Open Source to SaaS
WSO2CON 2024 Slides - Open Source to SaaS
 
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
 
Artyushina_Guest lecture_YorkU CS May 2024.pptx
Artyushina_Guest lecture_YorkU CS May 2024.pptxArtyushina_Guest lecture_YorkU CS May 2024.pptx
Artyushina_Guest lecture_YorkU CS May 2024.pptx
 
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park %in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
 
WSO2Con204 - Hard Rock Presentation - Keynote
WSO2Con204 - Hard Rock Presentation - KeynoteWSO2Con204 - Hard Rock Presentation - Keynote
WSO2Con204 - Hard Rock Presentation - Keynote
 
WSO2CON 2024 - API Management Usage at La Poste and Its Impact on Business an...
WSO2CON 2024 - API Management Usage at La Poste and Its Impact on Business an...WSO2CON 2024 - API Management Usage at La Poste and Its Impact on Business an...
WSO2CON 2024 - API Management Usage at La Poste and Its Impact on Business an...
 
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
 
tonesoftg
tonesoftgtonesoftg
tonesoftg
 
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
 
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
 

Document db

  • 3. Agenda • Hvor passer DocumentDB ind? • Arkitektur • Tooling • REST API / SDK’er
  • 4. Data på Azure • SQL • Storage (blob, table, file, queue) • Redis Cache • Search • DocumentDB
  • 5. Dokumentdatabaser • Ingen schema • Json • Nestede komplekse datastrukturer • Advancerede query muligheder • Matcher godt med objektmodeller
  • 6. Hvordan adskiller DocumentDB sig? • Bygget til cloud • Elasticitet • High availability • Velkendte begreber fra SQL • SQL • Stored procedures • Triggers • User-defined functions
  • 8. {Json} Property User settable or system generated? Purpose _rid System generated System generated, unique and hierarchical identifier of the resource. _etag System generated etag of the resource required for optimistic concurrency control. _ts System generated Last updated timestamp of the resource. _self System generated Unique addressable URI of the resource. id User settable User defined unique name of the resource.
  • 9. Datatyper • Json.NET serializer • Datoer som ISO 8601 string
  • 11. Brugere og rettigheder • Account administrators • Read-only administrators • Database users and permissions • Manuelt styre adgang til resources • All / read var docUser = new User { Id = "mobileuser" }; docUser = await client.CreateUserAsync(database.SelfLink, docUser); var docPermission = new Permission { PermissionMode = PermissionMode.Read, ResourceLink = documentCollection.SelfLink, Id = "readperm" }; docPermission = await client.CreatePermissionAsync(docUser.SelfLink, docPermission); FeedResponse<Permission> permFeed = await client.ReadPermissionFeedAsync(docUser.SelfLink); List<Permission> permList = new List<Permission>(); foreach (Permission perm in permFeed) { permList.Add(perm); } DocumentClient userClient = new DocumentClient(new Uri(endpointUrl),permList);
  • 12. Consistency levels • Strong – quorum writes og reads. Forespørgsler er fuldt konsistente. • Bounded Staleness – write order er konsistent. Reads må være bagud med et specificeret antal operationer (eller tid i sekunder). • Session - write order og reads er konsistente inden for en client session. • Eventual – reads må være ude af sekvens, eg., nogle reads ser muligvis ikke de seneste ændringer
  • 13. Collections • Container til Json dokumenter • En collection kan indeholde forskellige typer dokumenter • Sharding og fan-out queries • Skaleringsenhed for transaktioner og queries • Konfigurerbar indexering
  • 14. Indexing • Automatic • Kan slås fra (kun query på id og selflink) • Query med FeedOptions.EnableScanInQuery • Tilføj eller fjern enkelte dokumenter (whitelist/blacklist) client.CreateDocumentAsync(defaultCollection.SelfLink, new { Name = ”Christian", isSpeaking = true }, new RequestOptions { IndexingDirective = IndexingDirective.Include } );
  • 15. Indexing modes • Consistent • Lazy (= eventual consistency level) var defaultCollection = new DocumentCollection { Name ="defaultCollection" }; defaultCollection.IndexingPolicy.Automatic = true; // Set IndexingMode to Lazy for bulk import/read heavy collections. defaultCollection.IndexingPolicy.IndexingMode = IndexingMode.Lazy; defaultCollection = await client.CreateDocumentCollectionAsync(database.SelfLink,defaultCollection);
  • 16. Skalering og pris • Capacity units • SSD storage og throughput
  • 17. Tools • Azure Portal • DocumentDBStudio (github) • Visual Studio (roadmap) • Azure DocumentDB Data Migration Tool (github) • Json • MongoDB • SQL Server • CSV
  • 18. REST API VALUE OF THE _SELF DESCRIPTION /dbs Feed of databases under a database account. /dbs/{_rid-db} Database with the unique id property with the value {_rid-db}. /dbs/{_rid-db}/colls/ Feed of collections under a database. /dbs/{_rid-db}/colls/{_rid-coll} Collection with the unique id property with the value {_rid-coll}. /dbs/{_rid-db}/users/ Feed of users under a database. /dbs/{_rid-db}/users/{_rid-user} User with the unique id property with the value {_rid-user}. /dbs/{_rid-db}/users/{_rid-user}/permissions Feed of permissions under a database. /dbs/{_rid-db}/users/{_rid- user}/permissions/{_rid-permission} Permission with the unique id property with the value {_rid-permission}. POST https://mydb.documents.azure.com/dbs/XP0mAA==/colls/XP0mAJ3H-AA=/docs HTTP/1.1 x-ms-documentdb-isquery: True x-ms-date: Mon, 18 Aug 2014 13:05:49 GMT authorization: type%3dmaster%26ver%3d1.0%26sig%3dkOU%2bBn2vkvIlHypfE8AA5fulpn8zKjLwdrxBqyg0YGQ%3d x-ms-version: 2014-08-21 Accept: application/json Content-Type: application/query+json Host: mydb.documents.azure.com Content-Length: 50 { query: "SELECT * FROM root WHERE (root.Person.id = 'Jens')", parameters: [] }
  • 19. SDK’er • Dokumentation og samples: • http://azure.microsoft.com/da-dk/documentation/services/documentdb • https://code.msdn.microsoft.com/windowsazure/Azure-DocumentDB-NET-Code-6b3da8af • .NET (Nuget) • LINQ • Java • Python • Node • JavaScript (database)
  • 20. .NET SDK • Nuget • Client • Database • Collection • Selflinks
  • 21. Performance • Én client i applikationens levetid • Cache selflinks • Call client.OpenAsync() • ConnectionMode (gateway/direct) • Protocol (https/tcp) new DocumentClient(new Uri(MyEndPointUrl), MyAuthorizationKey, new ConnectionPolicy() { ConnectionMode = ConnectionMode.Direct, ConnectionProtocol = Protocol.Tcp });
  • 22. Queries • SQL • Parameters • LINQ • Forskellige typer i samme collection • Ingen Skip, Top, Count… SELECT f.id AS familyName, c.givenName AS childGivenName, c.firstName AS childFirstName, p.givenName AS petName FROM Families f JOIN c IN f.children JOIN p IN c.pets WHERE p.givenName = "King"
  • 23. User-defined functions • JavaScript • Opret som ressource • Brug fra Queries var udf = new UserDefinedFunction { Id = "myUdf", Body = udfBody, }; await client.CreateUserDefinedFunctionAsync(colSelfLink, udf);
  • 24. Triggers • JavaScript • Opret som ressource • Specificeres ved operation var triggerId = "myTrigger"; Trigger trigger = new Trigger { Id = triggerId, Body = triggerBody, TriggerOperation = TriggerOperation.Create, TriggerType = TriggerType.Post //Pre or Post }; await client.CreateTriggerAsync(colSelfLink, trigger); var requestOptions = new RequestOptions { PostTriggerInclude = new List<string> { triggerId } }; await client.CreateDocumentAsync(colSelfLink, myDocument, requestOptions);
  • 25. Stored procedures • JavaScript • Opret som ressource • Execute • Tidsgrænse await _client.CreateStoredProcedureAsync(colSelfLink, new StoredProcedure() { Id = "mySproc", Body = sprocBody }); var sproc = _client.CreateStoredProcedureQuery(colSelfLink) .ToList().Single(sp => sp.Id == "mySproc"); var sprocResponse = await _client.ExecuteStoredProcedureAsync<int>(sproc.SelfLink, objData);
  • 26. Transaktioner • Dybt integrerede i javascript modellen • Funktion = ACID transaktion med snapshot isolation • Exception => rollback
  • 27. Takeaways • Dokumentdatabaser • Forståelse for arkitekturen • Overblik over tooling og sdk’er • Mod på at bruge DocumentDB

Notas do Editor

  1. Overvej at gemme som datoer som Epoch
  2. http://azure.microsoft.com/en-us/documentation/articles/documentdb-indexing-policies/
  3. Yderligere indextuning er muligt da man kan angive præcision
  4. http://azure.microsoft.com/en-us/documentation/articles/documentdb-indexing-policies/
  5. Authorization Signatures X-ms-date
  6. Mean stack konkurrent (Mongo, ExpressJS, Angular, Node)
  7. Gateway holder styr på routing tabel til noderne collections fordeles over Gateway bedste bud på et firmanetværk bag en firewall TCP kun i direct mode