SlideShare uma empresa Scribd logo
1 de 21
Back to Basics 2016 : Webinar 3
Thinking in Documents
Emmanuel DELETANG
Senior solutions architecte france
Emmanuel.deletang@mongodb.com
V1.2
3
Review
• Webinar 1 : introduction au NOSQL
– Types de bases NoSQL
– MongoDB la base orientée document
– Replica Sets et Shards
• Webinar 2
– Fabriquer une application
– Ajout d’indexes
– Utilisation de la fonction “Explain”
4
Pensez en mode document
• Les documents MongoDB sont des objets JavaScript
(JSON)
• Ils sont codés comme BSON
• BSON = " Binary JSON "
• BSON permet un encodage/décodage de JSON
• Plus efficace lors de la transmission et le stockage sur
disque des données
• Élimine le besoin de "text analyser " tous les sous-objets
• Spécification publique sur http://bsonspec.org/
5
Exemple Document
{
first_name: ‘emmanuel’,
surname: ‘DELETANG’,
cell: +33617940786,
city: ‘PARIS’,
location: [45.123,47.232],
Profession: [‘SA’, ‘mongo’, ‘python’],
cars: [
{ model: ‘RENAULT’,
year: 2013,
value: 1000, … },
{ model: ‘UP’,
year: 2015,
value: 3300, … }
]
}
Sous documents
Champs
Type
tableau
6
Data Stores – Key Value
Key 1 Value
Key 1 Value
Key 1 Value
7
Data Stores - Relational
Key 1
Value 1
Value 1
Value 1
Value 1
Key 2
Value 1
Value 1
Value 1
Value 1
Key 3
Value 1
Value 1
Value 1
Value 1
Key 4
Value 1
Value 1
Value 1
Value 1
8
Data Stores - Document
Key3
Key4
Key5
Value 3
Value 5
Value 4Key6
Value 5Key7
Value 2
Value 1Key1
Key1
Key1
Key2
9
In Document Form
{ “key1” : “value 1” }
{ “key1” : { “key2” : “value 1”,
“key3” : { “key4” : “value 3”,
“key5” : “value 4” }
}
{ “key1” : { “key6” : “value 5”,
“key7” : “value 6” }
}
10
Some Example Queries
# trouver les 2 premiers documents
db.demo.find( { “key1” : “value 1” } )
# trouver le second document par valeur intégrée
(embedded)
db.demo.find( { "key1.key3.key4" : "value 3" } )
# trouver le 3 eme document
db.demo.find( { "key1.key6" : "value 4" } )
11
Modèle et Cardinalité
• 1 à 1
–Titre et post de blog
• Un à N
– Blog après des commentaires
• Un à Millions
–Blog post avec des vues de site (par exemple
Huffington Post )
12
Un a un
{
“Title” : “Ceci est un blog ”,
“Body” : “Ceci est le corps du texte d'un blog très court”,
…
}
Nous pouvons indexer “Title” et “Body”.
13
Un a N
{
“Title” : “This is a blog post”,
“Body” : “This is the body text”,
“Comments” : [ { “name” : “emmanuel deletang”,
“email” : “Emmanuel.deletang@mongodb.com”,
“comment” : “J'aime ta façon d'écrire” },
{ “name” : “John Smith”,
“email” : “John.Smith@example.com”,
“comment” : “Je déteste ta façon d'écrire” }]
}
Lorsque nous nous attendons à un petit nombre de commentaires
que nous pouvons intégrer dans le document principal
14
Points clés
• Quels sont les modèles d'écriture ?
– Les commentaires sont ajoutés plus fréquemment que les
messages
– Les commentaires peuvent avoir des images , des balises ,
des grands corps de texte
• Quels sont les modèles de lecture ?
– Les commentaires ne peuvent pas être affichés
– Les commentaires sont peut-être montrés dans leur propre
fenêtre
– Les gens regardent rarement tous les commentaires
15
Approche 2 – collections séparées
• Gardez tous les commentaires dans une collection de commentaires séparés
• Ajoutez des références à des commentaires comme un tableau de commentaire ID
• Nécessite deux requêtes pour afficher blog et commentaires associés
• Nécessite deux écritures pour créer un commentaire
{
_id : ObjectID( “AAAA” ),
name : “Joe Drumgoole”,
email : “Joe.Drumgoole@mongodb.com”,
comment :“I love your writing style”,
}
{
_id : ObjectID( “AAAB” ),
name : “John Smith”,
email : “Joe.Drumgoole@mongodb.com”,
comment :“I hate your writing style”,
}
{
“_id” : ObjectID( “ZZZZ” ),
“Title” : “A Blog Title”,
“Body” : “A blog post”,
“comments” : [ ObjectID( “AAAA” ),
ObjectID( “AAAB” )]
}
{
“_id” : ObjectID( “ZZZZ” ),
“Title” : “A Blog Title”,
“Body” : “A blog post”,
“comments” : []
}
16
Approche 3 – une solution Hybride
{
“_id” : ObjectID( “ZZZZ” ),
“Title” : “A Blog Title”,
“Body” : “A blog post”,
“comments” : [{
“_id” : ObjectID( “AAAA” )
“name” : “Joe Drumgoole”,
“email” : “Joe.D@mongodb.com”,
comment :“I love your writing style”,
}
{
_id : ObjectID( “AAAB” ),
name : “John Smith”,
email : “Joe.Drumgoole@mongodb.com”,
comment :“I hate your writing style”,
}]
}
{
“_post_jd” : ObjectID( “ZZZZ” ),
“comments” : [{
“_id” : ObjectID( “AAAA” )
“name” : “Joe Drumgoole”,
“email” : “Joe.D@mongodb.com”,
“comment” :“I love your writing
style”,
}
{...},{...},{...},{...},{...},{...}
,{..},{...},{...},{...} ]
17
Et si on a « un vers Million »
• Par exemple si on souhaite suivre chaque click de Souris ?
– Chaque utilisateur va générer des tonnes d’information
– Milliers de données par post
– Millions de données pour un blog ?
• Inverser le model
– Sauvegarder un blog ID per event ?
{
“post_id” : ObjectID(“ZZZZ”),
“timestamp” : ISODate("2005-01-02T00:00:00Z”),
“location” : [24, 34]
“click” : False,
}
18
Mais – un nombre fini d'événements par seconde
{
post_id : ObjectID ( “ZZZZ” ),
timeStamp: ISODate("2005-01-02T00:00:00Z”),
events : {
0 : { 0 : { <Info> }, 1 : { <Info> }, … 99: { <Info> }},
1 : { 0 : { <Info> }, 1 : { <Info> }, … 99: { <Info> }},
2 : { 0 : { <Info> }, 1 : { <Info> }, … 99: { <Info> }},
3 : { 0 : { <Info> }, 1 : { <Info> }, … 99: { <Info> }},
...
59 :{ 0 : { <Info> }, 1 : { <Info> }, … 99: { <Info> }}
}
19
Lignes directrices
• Imbriquer les objets pour le one to one
• Regarder la notions de lecture écriture pour déterminer la rupture de
données
• Ne restez pas coincés dans " un enregistrement " par article
• Pensez a la hiérarchie
• Pensez à la cardinalité
• Cultivez vos données en ajoutant des documents sans augmenter la taille
du document
• Pensez à vos index
• Une mises à jour de documents est une transaction
20
Webinar suivant: Indexation avancée , texte et index géospatial
• Prise en charge complète de texte permettant à un utilisateur
d’indexer tout le contenu textuel dans leur base de données
«comme Google» pour de la recherche sur un ensemble de
données
• Indexes géospatiaux qui permettent à un utilisateur de stocker
des coordonnées géospatiales et d’effectuer des recherches sur
la base de la proximité d'un point à un autre .
Mercredi 13 Juillet, 14:00 CET.
Webinaire 3 de la série « Retour aux fondamentaux » : Conception de schémas : penser en termes de documents

Mais conteúdo relacionado

Mais procurados

Breizhcamp 2015 - Comment (ne pas réussir à) modéliser ses data dans elastics...
Breizhcamp 2015 - Comment (ne pas réussir à) modéliser ses data dans elastics...Breizhcamp 2015 - Comment (ne pas réussir à) modéliser ses data dans elastics...
Breizhcamp 2015 - Comment (ne pas réussir à) modéliser ses data dans elastics...Bruno Bonnin
 
Gestion des données d'entreprise à l'ère de MongoDB et du Data Lake
Gestion des données d'entreprise à l'ère de MongoDB et du Data LakeGestion des données d'entreprise à l'ère de MongoDB et du Data Lake
Gestion des données d'entreprise à l'ère de MongoDB et du Data LakeMongoDB
 
Présentation de ElasticSearch / Digital apéro du 12/11/2014
Présentation de ElasticSearch / Digital apéro du 12/11/2014Présentation de ElasticSearch / Digital apéro du 12/11/2014
Présentation de ElasticSearch / Digital apéro du 12/11/2014Silicon Comté
 
2014 03-26-appdevseries-session3-interactingwiththedatabase-fr-phpapp01-rev.
2014 03-26-appdevseries-session3-interactingwiththedatabase-fr-phpapp01-rev.2014 03-26-appdevseries-session3-interactingwiththedatabase-fr-phpapp01-rev.
2014 03-26-appdevseries-session3-interactingwiththedatabase-fr-phpapp01-rev.MongoDB
 
MongoDB et Elasticsearch, meilleurs ennemis ?
MongoDB et Elasticsearch, meilleurs ennemis ?MongoDB et Elasticsearch, meilleurs ennemis ?
MongoDB et Elasticsearch, meilleurs ennemis ?Sébastien Prunier
 
Elasticsearch - Montpellier JUG
Elasticsearch - Montpellier JUGElasticsearch - Montpellier JUG
Elasticsearch - Montpellier JUGDavid Pilato
 
Découverte de Elastic search
Découverte de Elastic searchDécouverte de Elastic search
Découverte de Elastic searchJEMLI Fathi
 
Nantes JUG - Elasticsearch
Nantes JUG - ElasticsearchNantes JUG - Elasticsearch
Nantes JUG - ElasticsearchDavid Pilato
 
Tout ce que le getting started mongo db ne vous dira pas
Tout ce que le getting started mongo db ne vous dira pasTout ce que le getting started mongo db ne vous dira pas
Tout ce que le getting started mongo db ne vous dira pasPierre-Alban DEWITTE
 
Quand utiliser MongoDB … Et quand vous en passer…
Quand utiliser MongoDB	… Et quand vous en passer…Quand utiliser MongoDB	… Et quand vous en passer…
Quand utiliser MongoDB … Et quand vous en passer…MongoDB
 
Normandy JUG - Elasticsearch
Normandy JUG - ElasticsearchNormandy JUG - Elasticsearch
Normandy JUG - ElasticsearchDavid Pilato
 
Toutes les raisons d'adopter MongoDB
Toutes les raisons d'adopter MongoDBToutes les raisons d'adopter MongoDB
Toutes les raisons d'adopter MongoDBContent Square
 
Poitou charentes JUG - Elasticsearch
Poitou charentes JUG - ElasticsearchPoitou charentes JUG - Elasticsearch
Poitou charentes JUG - ElasticsearchDavid Pilato
 
Migrer une application existante vers Elasticsearch - Nuxeo Tour 2014 - workshop
Migrer une application existante vers Elasticsearch - Nuxeo Tour 2014 - workshopMigrer une application existante vers Elasticsearch - Nuxeo Tour 2014 - workshop
Migrer une application existante vers Elasticsearch - Nuxeo Tour 2014 - workshopNuxeo
 
Présentation mongoDB et mongoId
Présentation mongoDB et mongoIdPrésentation mongoDB et mongoId
Présentation mongoDB et mongoIdvtabary
 
Elasticsearch - Devoxx France 2012
Elasticsearch - Devoxx France 2012Elasticsearch - Devoxx France 2012
Elasticsearch - Devoxx France 2012David Pilato
 
Finist JUG - Elasticsearch
Finist JUG - ElasticsearchFinist JUG - Elasticsearch
Finist JUG - ElasticsearchDavid Pilato
 
Les nouveautés de MongoDB 3.6
Les nouveautés de MongoDB 3.6Les nouveautés de MongoDB 3.6
Les nouveautés de MongoDB 3.6MongoDB
 

Mais procurados (20)

introduction à MongoDB
introduction à MongoDBintroduction à MongoDB
introduction à MongoDB
 
Breizhcamp 2015 - Comment (ne pas réussir à) modéliser ses data dans elastics...
Breizhcamp 2015 - Comment (ne pas réussir à) modéliser ses data dans elastics...Breizhcamp 2015 - Comment (ne pas réussir à) modéliser ses data dans elastics...
Breizhcamp 2015 - Comment (ne pas réussir à) modéliser ses data dans elastics...
 
Gestion des données d'entreprise à l'ère de MongoDB et du Data Lake
Gestion des données d'entreprise à l'ère de MongoDB et du Data LakeGestion des données d'entreprise à l'ère de MongoDB et du Data Lake
Gestion des données d'entreprise à l'ère de MongoDB et du Data Lake
 
Présentation de ElasticSearch / Digital apéro du 12/11/2014
Présentation de ElasticSearch / Digital apéro du 12/11/2014Présentation de ElasticSearch / Digital apéro du 12/11/2014
Présentation de ElasticSearch / Digital apéro du 12/11/2014
 
2014 03-26-appdevseries-session3-interactingwiththedatabase-fr-phpapp01-rev.
2014 03-26-appdevseries-session3-interactingwiththedatabase-fr-phpapp01-rev.2014 03-26-appdevseries-session3-interactingwiththedatabase-fr-phpapp01-rev.
2014 03-26-appdevseries-session3-interactingwiththedatabase-fr-phpapp01-rev.
 
Pg jsonb format 16-9
Pg jsonb format 16-9Pg jsonb format 16-9
Pg jsonb format 16-9
 
MongoDB et Elasticsearch, meilleurs ennemis ?
MongoDB et Elasticsearch, meilleurs ennemis ?MongoDB et Elasticsearch, meilleurs ennemis ?
MongoDB et Elasticsearch, meilleurs ennemis ?
 
Elasticsearch - Montpellier JUG
Elasticsearch - Montpellier JUGElasticsearch - Montpellier JUG
Elasticsearch - Montpellier JUG
 
Découverte de Elastic search
Découverte de Elastic searchDécouverte de Elastic search
Découverte de Elastic search
 
Nantes JUG - Elasticsearch
Nantes JUG - ElasticsearchNantes JUG - Elasticsearch
Nantes JUG - Elasticsearch
 
Tout ce que le getting started mongo db ne vous dira pas
Tout ce que le getting started mongo db ne vous dira pasTout ce que le getting started mongo db ne vous dira pas
Tout ce que le getting started mongo db ne vous dira pas
 
Quand utiliser MongoDB … Et quand vous en passer…
Quand utiliser MongoDB	… Et quand vous en passer…Quand utiliser MongoDB	… Et quand vous en passer…
Quand utiliser MongoDB … Et quand vous en passer…
 
Normandy JUG - Elasticsearch
Normandy JUG - ElasticsearchNormandy JUG - Elasticsearch
Normandy JUG - Elasticsearch
 
Toutes les raisons d'adopter MongoDB
Toutes les raisons d'adopter MongoDBToutes les raisons d'adopter MongoDB
Toutes les raisons d'adopter MongoDB
 
Poitou charentes JUG - Elasticsearch
Poitou charentes JUG - ElasticsearchPoitou charentes JUG - Elasticsearch
Poitou charentes JUG - Elasticsearch
 
Migrer une application existante vers Elasticsearch - Nuxeo Tour 2014 - workshop
Migrer une application existante vers Elasticsearch - Nuxeo Tour 2014 - workshopMigrer une application existante vers Elasticsearch - Nuxeo Tour 2014 - workshop
Migrer une application existante vers Elasticsearch - Nuxeo Tour 2014 - workshop
 
Présentation mongoDB et mongoId
Présentation mongoDB et mongoIdPrésentation mongoDB et mongoId
Présentation mongoDB et mongoId
 
Elasticsearch - Devoxx France 2012
Elasticsearch - Devoxx France 2012Elasticsearch - Devoxx France 2012
Elasticsearch - Devoxx France 2012
 
Finist JUG - Elasticsearch
Finist JUG - ElasticsearchFinist JUG - Elasticsearch
Finist JUG - Elasticsearch
 
Les nouveautés de MongoDB 3.6
Les nouveautés de MongoDB 3.6Les nouveautés de MongoDB 3.6
Les nouveautés de MongoDB 3.6
 

Semelhante a Webinaire 3 de la série « Retour aux fondamentaux » : Conception de schémas : penser en termes de documents

2014 03-12-fr schema design and app architecture-2
2014 03-12-fr schema design and app architecture-22014 03-12-fr schema design and app architecture-2
2014 03-12-fr schema design and app architecture-2MongoDB
 
Tout ce que le getting started mongodb ne vous dira pas
Tout ce que le getting started mongodb ne vous dira pasTout ce que le getting started mongodb ne vous dira pas
Tout ce que le getting started mongodb ne vous dira pasBruno Bonnin
 
Tout ce que le getting started MongoDB ne vous dira pas
Tout ce que le getting started MongoDB ne vous dira pasTout ce que le getting started MongoDB ne vous dira pas
Tout ce que le getting started MongoDB ne vous dira pasBruno Bonnin
 
2014 04-09-fr - app dev series - session 4 - indexing
2014 04-09-fr - app dev series - session 4 - indexing2014 04-09-fr - app dev series - session 4 - indexing
2014 04-09-fr - app dev series - session 4 - indexingMongoDB
 
Elasticsearch - Esme sudria
Elasticsearch - Esme sudriaElasticsearch - Esme sudria
Elasticsearch - Esme sudriaDavid Pilato
 
SP2013 - Centraliser vos modèles de documents
SP2013 - Centraliser vos modèles de documentsSP2013 - Centraliser vos modèles de documents
SP2013 - Centraliser vos modèles de documentsRan Mellul
 
Lyon JUG - Elasticsearch
Lyon JUG - ElasticsearchLyon JUG - Elasticsearch
Lyon JUG - ElasticsearchDavid Pilato
 
2014 03-26-appdevseries-session3-interactingwiththedatabase-fr-phpapp01
2014 03-26-appdevseries-session3-interactingwiththedatabase-fr-phpapp012014 03-26-appdevseries-session3-interactingwiththedatabase-fr-phpapp01
2014 03-26-appdevseries-session3-interactingwiththedatabase-fr-phpapp01MongoDB
 
JugSummerCamp 2013 - Un backend NoSQL pour Geektic avec MongoDB
JugSummerCamp 2013 - Un backend NoSQL pour Geektic avec MongoDBJugSummerCamp 2013 - Un backend NoSQL pour Geektic avec MongoDB
JugSummerCamp 2013 - Un backend NoSQL pour Geektic avec MongoDBSébastien Prunier
 
Support Formation vidéo: MongoDB pour débutant
Support Formation vidéo: MongoDB pour débutantSupport Formation vidéo: MongoDB pour débutant
Support Formation vidéo: MongoDB pour débutantSmartnSkilled
 
MongoDB_presentation_ye.pptx
MongoDB_presentation_ye.pptxMongoDB_presentation_ye.pptx
MongoDB_presentation_ye.pptxZALIMAZA
 
MongoDB_presentation_Moyou.pptx
MongoDB_presentation_Moyou.pptxMongoDB_presentation_Moyou.pptx
MongoDB_presentation_Moyou.pptxZALIMAZA
 
MongoDB_presentation_p.pptx
MongoDB_presentation_p.pptxMongoDB_presentation_p.pptx
MongoDB_presentation_p.pptxZALIMAZA
 
MongoDB_presentation_xmls.pptx
MongoDB_presentation_xmls.pptxMongoDB_presentation_xmls.pptx
MongoDB_presentation_xmls.pptxZALIMAZA
 
MongoDB_presentation.pptx
MongoDB_presentation.pptxMongoDB_presentation.pptx
MongoDB_presentation.pptxZALIMAZA
 
Hands on lab Elasticsearch
Hands on lab ElasticsearchHands on lab Elasticsearch
Hands on lab ElasticsearchDavid Pilato
 
MongoDB_presentation_o.pptx
MongoDB_presentation_o.pptxMongoDB_presentation_o.pptx
MongoDB_presentation_o.pptxZALIMAZA
 
MongoDB_presentation_tts.pptx
MongoDB_presentation_tts.pptxMongoDB_presentation_tts.pptx
MongoDB_presentation_tts.pptxZALIMAZA
 
Atelier : Développement rapide d&rsquo;une application basée surXWiki
Atelier : Développement rapide d&rsquo;une application basée surXWikiAtelier : Développement rapide d&rsquo;une application basée surXWiki
Atelier : Développement rapide d&rsquo;une application basée surXWikiKorteby Farouk
 

Semelhante a Webinaire 3 de la série « Retour aux fondamentaux » : Conception de schémas : penser en termes de documents (20)

2014 03-12-fr schema design and app architecture-2
2014 03-12-fr schema design and app architecture-22014 03-12-fr schema design and app architecture-2
2014 03-12-fr schema design and app architecture-2
 
Tout ce que le getting started mongodb ne vous dira pas
Tout ce que le getting started mongodb ne vous dira pasTout ce que le getting started mongodb ne vous dira pas
Tout ce que le getting started mongodb ne vous dira pas
 
Tout ce que le getting started MongoDB ne vous dira pas
Tout ce que le getting started MongoDB ne vous dira pasTout ce que le getting started MongoDB ne vous dira pas
Tout ce que le getting started MongoDB ne vous dira pas
 
2014 04-09-fr - app dev series - session 4 - indexing
2014 04-09-fr - app dev series - session 4 - indexing2014 04-09-fr - app dev series - session 4 - indexing
2014 04-09-fr - app dev series - session 4 - indexing
 
Elasticsearch - Esme sudria
Elasticsearch - Esme sudriaElasticsearch - Esme sudria
Elasticsearch - Esme sudria
 
SP2013 - Centraliser vos modèles de documents
SP2013 - Centraliser vos modèles de documentsSP2013 - Centraliser vos modèles de documents
SP2013 - Centraliser vos modèles de documents
 
Lyon JUG - Elasticsearch
Lyon JUG - ElasticsearchLyon JUG - Elasticsearch
Lyon JUG - Elasticsearch
 
2014 03-26-appdevseries-session3-interactingwiththedatabase-fr-phpapp01
2014 03-26-appdevseries-session3-interactingwiththedatabase-fr-phpapp012014 03-26-appdevseries-session3-interactingwiththedatabase-fr-phpapp01
2014 03-26-appdevseries-session3-interactingwiththedatabase-fr-phpapp01
 
Formation NoSQL
Formation NoSQLFormation NoSQL
Formation NoSQL
 
JugSummerCamp 2013 - Un backend NoSQL pour Geektic avec MongoDB
JugSummerCamp 2013 - Un backend NoSQL pour Geektic avec MongoDBJugSummerCamp 2013 - Un backend NoSQL pour Geektic avec MongoDB
JugSummerCamp 2013 - Un backend NoSQL pour Geektic avec MongoDB
 
Support Formation vidéo: MongoDB pour débutant
Support Formation vidéo: MongoDB pour débutantSupport Formation vidéo: MongoDB pour débutant
Support Formation vidéo: MongoDB pour débutant
 
MongoDB_presentation_ye.pptx
MongoDB_presentation_ye.pptxMongoDB_presentation_ye.pptx
MongoDB_presentation_ye.pptx
 
MongoDB_presentation_Moyou.pptx
MongoDB_presentation_Moyou.pptxMongoDB_presentation_Moyou.pptx
MongoDB_presentation_Moyou.pptx
 
MongoDB_presentation_p.pptx
MongoDB_presentation_p.pptxMongoDB_presentation_p.pptx
MongoDB_presentation_p.pptx
 
MongoDB_presentation_xmls.pptx
MongoDB_presentation_xmls.pptxMongoDB_presentation_xmls.pptx
MongoDB_presentation_xmls.pptx
 
MongoDB_presentation.pptx
MongoDB_presentation.pptxMongoDB_presentation.pptx
MongoDB_presentation.pptx
 
Hands on lab Elasticsearch
Hands on lab ElasticsearchHands on lab Elasticsearch
Hands on lab Elasticsearch
 
MongoDB_presentation_o.pptx
MongoDB_presentation_o.pptxMongoDB_presentation_o.pptx
MongoDB_presentation_o.pptx
 
MongoDB_presentation_tts.pptx
MongoDB_presentation_tts.pptxMongoDB_presentation_tts.pptx
MongoDB_presentation_tts.pptx
 
Atelier : Développement rapide d&rsquo;une application basée surXWiki
Atelier : Développement rapide d&rsquo;une application basée surXWikiAtelier : Développement rapide d&rsquo;une application basée surXWiki
Atelier : Développement rapide d&rsquo;une application basée surXWiki
 

Mais de MongoDB

MongoDB SoCal 2020: Migrate Anything* to MongoDB Atlas
MongoDB SoCal 2020: Migrate Anything* to MongoDB AtlasMongoDB SoCal 2020: Migrate Anything* to MongoDB Atlas
MongoDB SoCal 2020: Migrate Anything* to MongoDB AtlasMongoDB
 
MongoDB SoCal 2020: Go on a Data Safari with MongoDB Charts!
MongoDB SoCal 2020: Go on a Data Safari with MongoDB Charts!MongoDB SoCal 2020: Go on a Data Safari with MongoDB Charts!
MongoDB SoCal 2020: Go on a Data Safari with MongoDB Charts!MongoDB
 
MongoDB SoCal 2020: Using MongoDB Services in Kubernetes: Any Platform, Devel...
MongoDB SoCal 2020: Using MongoDB Services in Kubernetes: Any Platform, Devel...MongoDB SoCal 2020: Using MongoDB Services in Kubernetes: Any Platform, Devel...
MongoDB SoCal 2020: Using MongoDB Services in Kubernetes: Any Platform, Devel...MongoDB
 
MongoDB SoCal 2020: A Complete Methodology of Data Modeling for MongoDB
MongoDB SoCal 2020: A Complete Methodology of Data Modeling for MongoDBMongoDB SoCal 2020: A Complete Methodology of Data Modeling for MongoDB
MongoDB SoCal 2020: A Complete Methodology of Data Modeling for MongoDBMongoDB
 
MongoDB SoCal 2020: From Pharmacist to Analyst: Leveraging MongoDB for Real-T...
MongoDB SoCal 2020: From Pharmacist to Analyst: Leveraging MongoDB for Real-T...MongoDB SoCal 2020: From Pharmacist to Analyst: Leveraging MongoDB for Real-T...
MongoDB SoCal 2020: From Pharmacist to Analyst: Leveraging MongoDB for Real-T...MongoDB
 
MongoDB SoCal 2020: Best Practices for Working with IoT and Time-series Data
MongoDB SoCal 2020: Best Practices for Working with IoT and Time-series DataMongoDB SoCal 2020: Best Practices for Working with IoT and Time-series Data
MongoDB SoCal 2020: Best Practices for Working with IoT and Time-series DataMongoDB
 
MongoDB SoCal 2020: MongoDB Atlas Jump Start
 MongoDB SoCal 2020: MongoDB Atlas Jump Start MongoDB SoCal 2020: MongoDB Atlas Jump Start
MongoDB SoCal 2020: MongoDB Atlas Jump StartMongoDB
 
MongoDB .local San Francisco 2020: Powering the new age data demands [Infosys]
MongoDB .local San Francisco 2020: Powering the new age data demands [Infosys]MongoDB .local San Francisco 2020: Powering the new age data demands [Infosys]
MongoDB .local San Francisco 2020: Powering the new age data demands [Infosys]MongoDB
 
MongoDB .local San Francisco 2020: Using Client Side Encryption in MongoDB 4.2
MongoDB .local San Francisco 2020: Using Client Side Encryption in MongoDB 4.2MongoDB .local San Francisco 2020: Using Client Side Encryption in MongoDB 4.2
MongoDB .local San Francisco 2020: Using Client Side Encryption in MongoDB 4.2MongoDB
 
MongoDB .local San Francisco 2020: Using MongoDB Services in Kubernetes: any ...
MongoDB .local San Francisco 2020: Using MongoDB Services in Kubernetes: any ...MongoDB .local San Francisco 2020: Using MongoDB Services in Kubernetes: any ...
MongoDB .local San Francisco 2020: Using MongoDB Services in Kubernetes: any ...MongoDB
 
MongoDB .local San Francisco 2020: Go on a Data Safari with MongoDB Charts!
MongoDB .local San Francisco 2020: Go on a Data Safari with MongoDB Charts!MongoDB .local San Francisco 2020: Go on a Data Safari with MongoDB Charts!
MongoDB .local San Francisco 2020: Go on a Data Safari with MongoDB Charts!MongoDB
 
MongoDB .local San Francisco 2020: From SQL to NoSQL -- Changing Your Mindset
MongoDB .local San Francisco 2020: From SQL to NoSQL -- Changing Your MindsetMongoDB .local San Francisco 2020: From SQL to NoSQL -- Changing Your Mindset
MongoDB .local San Francisco 2020: From SQL to NoSQL -- Changing Your MindsetMongoDB
 
MongoDB .local San Francisco 2020: MongoDB Atlas Jumpstart
MongoDB .local San Francisco 2020: MongoDB Atlas JumpstartMongoDB .local San Francisco 2020: MongoDB Atlas Jumpstart
MongoDB .local San Francisco 2020: MongoDB Atlas JumpstartMongoDB
 
MongoDB .local San Francisco 2020: Tips and Tricks++ for Querying and Indexin...
MongoDB .local San Francisco 2020: Tips and Tricks++ for Querying and Indexin...MongoDB .local San Francisco 2020: Tips and Tricks++ for Querying and Indexin...
MongoDB .local San Francisco 2020: Tips and Tricks++ for Querying and Indexin...MongoDB
 
MongoDB .local San Francisco 2020: Aggregation Pipeline Power++
MongoDB .local San Francisco 2020: Aggregation Pipeline Power++MongoDB .local San Francisco 2020: Aggregation Pipeline Power++
MongoDB .local San Francisco 2020: Aggregation Pipeline Power++MongoDB
 
MongoDB .local San Francisco 2020: A Complete Methodology of Data Modeling fo...
MongoDB .local San Francisco 2020: A Complete Methodology of Data Modeling fo...MongoDB .local San Francisco 2020: A Complete Methodology of Data Modeling fo...
MongoDB .local San Francisco 2020: A Complete Methodology of Data Modeling fo...MongoDB
 
MongoDB .local San Francisco 2020: MongoDB Atlas Data Lake Technical Deep Dive
MongoDB .local San Francisco 2020: MongoDB Atlas Data Lake Technical Deep DiveMongoDB .local San Francisco 2020: MongoDB Atlas Data Lake Technical Deep Dive
MongoDB .local San Francisco 2020: MongoDB Atlas Data Lake Technical Deep DiveMongoDB
 
MongoDB .local San Francisco 2020: Developing Alexa Skills with MongoDB & Golang
MongoDB .local San Francisco 2020: Developing Alexa Skills with MongoDB & GolangMongoDB .local San Francisco 2020: Developing Alexa Skills with MongoDB & Golang
MongoDB .local San Francisco 2020: Developing Alexa Skills with MongoDB & GolangMongoDB
 
MongoDB .local Paris 2020: Realm : l'ingrédient secret pour de meilleures app...
MongoDB .local Paris 2020: Realm : l'ingrédient secret pour de meilleures app...MongoDB .local Paris 2020: Realm : l'ingrédient secret pour de meilleures app...
MongoDB .local Paris 2020: Realm : l'ingrédient secret pour de meilleures app...MongoDB
 
MongoDB .local Paris 2020: Upply @MongoDB : Upply : Quand le Machine Learning...
MongoDB .local Paris 2020: Upply @MongoDB : Upply : Quand le Machine Learning...MongoDB .local Paris 2020: Upply @MongoDB : Upply : Quand le Machine Learning...
MongoDB .local Paris 2020: Upply @MongoDB : Upply : Quand le Machine Learning...MongoDB
 

Mais de MongoDB (20)

MongoDB SoCal 2020: Migrate Anything* to MongoDB Atlas
MongoDB SoCal 2020: Migrate Anything* to MongoDB AtlasMongoDB SoCal 2020: Migrate Anything* to MongoDB Atlas
MongoDB SoCal 2020: Migrate Anything* to MongoDB Atlas
 
MongoDB SoCal 2020: Go on a Data Safari with MongoDB Charts!
MongoDB SoCal 2020: Go on a Data Safari with MongoDB Charts!MongoDB SoCal 2020: Go on a Data Safari with MongoDB Charts!
MongoDB SoCal 2020: Go on a Data Safari with MongoDB Charts!
 
MongoDB SoCal 2020: Using MongoDB Services in Kubernetes: Any Platform, Devel...
MongoDB SoCal 2020: Using MongoDB Services in Kubernetes: Any Platform, Devel...MongoDB SoCal 2020: Using MongoDB Services in Kubernetes: Any Platform, Devel...
MongoDB SoCal 2020: Using MongoDB Services in Kubernetes: Any Platform, Devel...
 
MongoDB SoCal 2020: A Complete Methodology of Data Modeling for MongoDB
MongoDB SoCal 2020: A Complete Methodology of Data Modeling for MongoDBMongoDB SoCal 2020: A Complete Methodology of Data Modeling for MongoDB
MongoDB SoCal 2020: A Complete Methodology of Data Modeling for MongoDB
 
MongoDB SoCal 2020: From Pharmacist to Analyst: Leveraging MongoDB for Real-T...
MongoDB SoCal 2020: From Pharmacist to Analyst: Leveraging MongoDB for Real-T...MongoDB SoCal 2020: From Pharmacist to Analyst: Leveraging MongoDB for Real-T...
MongoDB SoCal 2020: From Pharmacist to Analyst: Leveraging MongoDB for Real-T...
 
MongoDB SoCal 2020: Best Practices for Working with IoT and Time-series Data
MongoDB SoCal 2020: Best Practices for Working with IoT and Time-series DataMongoDB SoCal 2020: Best Practices for Working with IoT and Time-series Data
MongoDB SoCal 2020: Best Practices for Working with IoT and Time-series Data
 
MongoDB SoCal 2020: MongoDB Atlas Jump Start
 MongoDB SoCal 2020: MongoDB Atlas Jump Start MongoDB SoCal 2020: MongoDB Atlas Jump Start
MongoDB SoCal 2020: MongoDB Atlas Jump Start
 
MongoDB .local San Francisco 2020: Powering the new age data demands [Infosys]
MongoDB .local San Francisco 2020: Powering the new age data demands [Infosys]MongoDB .local San Francisco 2020: Powering the new age data demands [Infosys]
MongoDB .local San Francisco 2020: Powering the new age data demands [Infosys]
 
MongoDB .local San Francisco 2020: Using Client Side Encryption in MongoDB 4.2
MongoDB .local San Francisco 2020: Using Client Side Encryption in MongoDB 4.2MongoDB .local San Francisco 2020: Using Client Side Encryption in MongoDB 4.2
MongoDB .local San Francisco 2020: Using Client Side Encryption in MongoDB 4.2
 
MongoDB .local San Francisco 2020: Using MongoDB Services in Kubernetes: any ...
MongoDB .local San Francisco 2020: Using MongoDB Services in Kubernetes: any ...MongoDB .local San Francisco 2020: Using MongoDB Services in Kubernetes: any ...
MongoDB .local San Francisco 2020: Using MongoDB Services in Kubernetes: any ...
 
MongoDB .local San Francisco 2020: Go on a Data Safari with MongoDB Charts!
MongoDB .local San Francisco 2020: Go on a Data Safari with MongoDB Charts!MongoDB .local San Francisco 2020: Go on a Data Safari with MongoDB Charts!
MongoDB .local San Francisco 2020: Go on a Data Safari with MongoDB Charts!
 
MongoDB .local San Francisco 2020: From SQL to NoSQL -- Changing Your Mindset
MongoDB .local San Francisco 2020: From SQL to NoSQL -- Changing Your MindsetMongoDB .local San Francisco 2020: From SQL to NoSQL -- Changing Your Mindset
MongoDB .local San Francisco 2020: From SQL to NoSQL -- Changing Your Mindset
 
MongoDB .local San Francisco 2020: MongoDB Atlas Jumpstart
MongoDB .local San Francisco 2020: MongoDB Atlas JumpstartMongoDB .local San Francisco 2020: MongoDB Atlas Jumpstart
MongoDB .local San Francisco 2020: MongoDB Atlas Jumpstart
 
MongoDB .local San Francisco 2020: Tips and Tricks++ for Querying and Indexin...
MongoDB .local San Francisco 2020: Tips and Tricks++ for Querying and Indexin...MongoDB .local San Francisco 2020: Tips and Tricks++ for Querying and Indexin...
MongoDB .local San Francisco 2020: Tips and Tricks++ for Querying and Indexin...
 
MongoDB .local San Francisco 2020: Aggregation Pipeline Power++
MongoDB .local San Francisco 2020: Aggregation Pipeline Power++MongoDB .local San Francisco 2020: Aggregation Pipeline Power++
MongoDB .local San Francisco 2020: Aggregation Pipeline Power++
 
MongoDB .local San Francisco 2020: A Complete Methodology of Data Modeling fo...
MongoDB .local San Francisco 2020: A Complete Methodology of Data Modeling fo...MongoDB .local San Francisco 2020: A Complete Methodology of Data Modeling fo...
MongoDB .local San Francisco 2020: A Complete Methodology of Data Modeling fo...
 
MongoDB .local San Francisco 2020: MongoDB Atlas Data Lake Technical Deep Dive
MongoDB .local San Francisco 2020: MongoDB Atlas Data Lake Technical Deep DiveMongoDB .local San Francisco 2020: MongoDB Atlas Data Lake Technical Deep Dive
MongoDB .local San Francisco 2020: MongoDB Atlas Data Lake Technical Deep Dive
 
MongoDB .local San Francisco 2020: Developing Alexa Skills with MongoDB & Golang
MongoDB .local San Francisco 2020: Developing Alexa Skills with MongoDB & GolangMongoDB .local San Francisco 2020: Developing Alexa Skills with MongoDB & Golang
MongoDB .local San Francisco 2020: Developing Alexa Skills with MongoDB & Golang
 
MongoDB .local Paris 2020: Realm : l'ingrédient secret pour de meilleures app...
MongoDB .local Paris 2020: Realm : l'ingrédient secret pour de meilleures app...MongoDB .local Paris 2020: Realm : l'ingrédient secret pour de meilleures app...
MongoDB .local Paris 2020: Realm : l'ingrédient secret pour de meilleures app...
 
MongoDB .local Paris 2020: Upply @MongoDB : Upply : Quand le Machine Learning...
MongoDB .local Paris 2020: Upply @MongoDB : Upply : Quand le Machine Learning...MongoDB .local Paris 2020: Upply @MongoDB : Upply : Quand le Machine Learning...
MongoDB .local Paris 2020: Upply @MongoDB : Upply : Quand le Machine Learning...
 

Último

Le contrôle de la recherche d'emploi en 2023
Le contrôle de la recherche d'emploi en 2023Le contrôle de la recherche d'emploi en 2023
Le contrôle de la recherche d'emploi en 2023France Travail
 
Recurrent neural network_PresentationRNN.pptx
Recurrent neural network_PresentationRNN.pptxRecurrent neural network_PresentationRNN.pptx
Recurrent neural network_PresentationRNN.pptxbahija babzine
 
Bidirectional Encoder Representations from Transformers
Bidirectional Encoder Representations from TransformersBidirectional Encoder Representations from Transformers
Bidirectional Encoder Representations from Transformersbahija babzine
 
ELABE BFMTV L'Opinion en direct - Les Français et les 100 jours de Gabriel Attal
ELABE BFMTV L'Opinion en direct - Les Français et les 100 jours de Gabriel AttalELABE BFMTV L'Opinion en direct - Les Français et les 100 jours de Gabriel Attal
ELABE BFMTV L'Opinion en direct - Les Français et les 100 jours de Gabriel Attalcontact Elabe
 
Montant moyen du droit d'allocation chômage versé aux demandeurs d'emploi ind...
Montant moyen du droit d'allocation chômage versé aux demandeurs d'emploi ind...Montant moyen du droit d'allocation chômage versé aux demandeurs d'emploi ind...
Montant moyen du droit d'allocation chômage versé aux demandeurs d'emploi ind...France Travail
 
To_understand_transformers_together presentation
To_understand_transformers_together presentationTo_understand_transformers_together presentation
To_understand_transformers_together presentationbahija babzine
 

Último (6)

Le contrôle de la recherche d'emploi en 2023
Le contrôle de la recherche d'emploi en 2023Le contrôle de la recherche d'emploi en 2023
Le contrôle de la recherche d'emploi en 2023
 
Recurrent neural network_PresentationRNN.pptx
Recurrent neural network_PresentationRNN.pptxRecurrent neural network_PresentationRNN.pptx
Recurrent neural network_PresentationRNN.pptx
 
Bidirectional Encoder Representations from Transformers
Bidirectional Encoder Representations from TransformersBidirectional Encoder Representations from Transformers
Bidirectional Encoder Representations from Transformers
 
ELABE BFMTV L'Opinion en direct - Les Français et les 100 jours de Gabriel Attal
ELABE BFMTV L'Opinion en direct - Les Français et les 100 jours de Gabriel AttalELABE BFMTV L'Opinion en direct - Les Français et les 100 jours de Gabriel Attal
ELABE BFMTV L'Opinion en direct - Les Français et les 100 jours de Gabriel Attal
 
Montant moyen du droit d'allocation chômage versé aux demandeurs d'emploi ind...
Montant moyen du droit d'allocation chômage versé aux demandeurs d'emploi ind...Montant moyen du droit d'allocation chômage versé aux demandeurs d'emploi ind...
Montant moyen du droit d'allocation chômage versé aux demandeurs d'emploi ind...
 
To_understand_transformers_together presentation
To_understand_transformers_together presentationTo_understand_transformers_together presentation
To_understand_transformers_together presentation
 

Webinaire 3 de la série « Retour aux fondamentaux » : Conception de schémas : penser en termes de documents

  • 1.
  • 2. Back to Basics 2016 : Webinar 3 Thinking in Documents Emmanuel DELETANG Senior solutions architecte france Emmanuel.deletang@mongodb.com V1.2
  • 3. 3 Review • Webinar 1 : introduction au NOSQL – Types de bases NoSQL – MongoDB la base orientée document – Replica Sets et Shards • Webinar 2 – Fabriquer une application – Ajout d’indexes – Utilisation de la fonction “Explain”
  • 4. 4 Pensez en mode document • Les documents MongoDB sont des objets JavaScript (JSON) • Ils sont codés comme BSON • BSON = " Binary JSON " • BSON permet un encodage/décodage de JSON • Plus efficace lors de la transmission et le stockage sur disque des données • Élimine le besoin de "text analyser " tous les sous-objets • Spécification publique sur http://bsonspec.org/
  • 5. 5 Exemple Document { first_name: ‘emmanuel’, surname: ‘DELETANG’, cell: +33617940786, city: ‘PARIS’, location: [45.123,47.232], Profession: [‘SA’, ‘mongo’, ‘python’], cars: [ { model: ‘RENAULT’, year: 2013, value: 1000, … }, { model: ‘UP’, year: 2015, value: 3300, … } ] } Sous documents Champs Type tableau
  • 6. 6 Data Stores – Key Value Key 1 Value Key 1 Value Key 1 Value
  • 7. 7 Data Stores - Relational Key 1 Value 1 Value 1 Value 1 Value 1 Key 2 Value 1 Value 1 Value 1 Value 1 Key 3 Value 1 Value 1 Value 1 Value 1 Key 4 Value 1 Value 1 Value 1 Value 1
  • 8. 8 Data Stores - Document Key3 Key4 Key5 Value 3 Value 5 Value 4Key6 Value 5Key7 Value 2 Value 1Key1 Key1 Key1 Key2
  • 9. 9 In Document Form { “key1” : “value 1” } { “key1” : { “key2” : “value 1”, “key3” : { “key4” : “value 3”, “key5” : “value 4” } } { “key1” : { “key6” : “value 5”, “key7” : “value 6” } }
  • 10. 10 Some Example Queries # trouver les 2 premiers documents db.demo.find( { “key1” : “value 1” } ) # trouver le second document par valeur intégrée (embedded) db.demo.find( { "key1.key3.key4" : "value 3" } ) # trouver le 3 eme document db.demo.find( { "key1.key6" : "value 4" } )
  • 11. 11 Modèle et Cardinalité • 1 à 1 –Titre et post de blog • Un à N – Blog après des commentaires • Un à Millions –Blog post avec des vues de site (par exemple Huffington Post )
  • 12. 12 Un a un { “Title” : “Ceci est un blog ”, “Body” : “Ceci est le corps du texte d'un blog très court”, … } Nous pouvons indexer “Title” et “Body”.
  • 13. 13 Un a N { “Title” : “This is a blog post”, “Body” : “This is the body text”, “Comments” : [ { “name” : “emmanuel deletang”, “email” : “Emmanuel.deletang@mongodb.com”, “comment” : “J'aime ta façon d'écrire” }, { “name” : “John Smith”, “email” : “John.Smith@example.com”, “comment” : “Je déteste ta façon d'écrire” }] } Lorsque nous nous attendons à un petit nombre de commentaires que nous pouvons intégrer dans le document principal
  • 14. 14 Points clés • Quels sont les modèles d'écriture ? – Les commentaires sont ajoutés plus fréquemment que les messages – Les commentaires peuvent avoir des images , des balises , des grands corps de texte • Quels sont les modèles de lecture ? – Les commentaires ne peuvent pas être affichés – Les commentaires sont peut-être montrés dans leur propre fenêtre – Les gens regardent rarement tous les commentaires
  • 15. 15 Approche 2 – collections séparées • Gardez tous les commentaires dans une collection de commentaires séparés • Ajoutez des références à des commentaires comme un tableau de commentaire ID • Nécessite deux requêtes pour afficher blog et commentaires associés • Nécessite deux écritures pour créer un commentaire { _id : ObjectID( “AAAA” ), name : “Joe Drumgoole”, email : “Joe.Drumgoole@mongodb.com”, comment :“I love your writing style”, } { _id : ObjectID( “AAAB” ), name : “John Smith”, email : “Joe.Drumgoole@mongodb.com”, comment :“I hate your writing style”, } { “_id” : ObjectID( “ZZZZ” ), “Title” : “A Blog Title”, “Body” : “A blog post”, “comments” : [ ObjectID( “AAAA” ), ObjectID( “AAAB” )] } { “_id” : ObjectID( “ZZZZ” ), “Title” : “A Blog Title”, “Body” : “A blog post”, “comments” : [] }
  • 16. 16 Approche 3 – une solution Hybride { “_id” : ObjectID( “ZZZZ” ), “Title” : “A Blog Title”, “Body” : “A blog post”, “comments” : [{ “_id” : ObjectID( “AAAA” ) “name” : “Joe Drumgoole”, “email” : “Joe.D@mongodb.com”, comment :“I love your writing style”, } { _id : ObjectID( “AAAB” ), name : “John Smith”, email : “Joe.Drumgoole@mongodb.com”, comment :“I hate your writing style”, }] } { “_post_jd” : ObjectID( “ZZZZ” ), “comments” : [{ “_id” : ObjectID( “AAAA” ) “name” : “Joe Drumgoole”, “email” : “Joe.D@mongodb.com”, “comment” :“I love your writing style”, } {...},{...},{...},{...},{...},{...} ,{..},{...},{...},{...} ]
  • 17. 17 Et si on a « un vers Million » • Par exemple si on souhaite suivre chaque click de Souris ? – Chaque utilisateur va générer des tonnes d’information – Milliers de données par post – Millions de données pour un blog ? • Inverser le model – Sauvegarder un blog ID per event ? { “post_id” : ObjectID(“ZZZZ”), “timestamp” : ISODate("2005-01-02T00:00:00Z”), “location” : [24, 34] “click” : False, }
  • 18. 18 Mais – un nombre fini d'événements par seconde { post_id : ObjectID ( “ZZZZ” ), timeStamp: ISODate("2005-01-02T00:00:00Z”), events : { 0 : { 0 : { <Info> }, 1 : { <Info> }, … 99: { <Info> }}, 1 : { 0 : { <Info> }, 1 : { <Info> }, … 99: { <Info> }}, 2 : { 0 : { <Info> }, 1 : { <Info> }, … 99: { <Info> }}, 3 : { 0 : { <Info> }, 1 : { <Info> }, … 99: { <Info> }}, ... 59 :{ 0 : { <Info> }, 1 : { <Info> }, … 99: { <Info> }} }
  • 19. 19 Lignes directrices • Imbriquer les objets pour le one to one • Regarder la notions de lecture écriture pour déterminer la rupture de données • Ne restez pas coincés dans " un enregistrement " par article • Pensez a la hiérarchie • Pensez à la cardinalité • Cultivez vos données en ajoutant des documents sans augmenter la taille du document • Pensez à vos index • Une mises à jour de documents est une transaction
  • 20. 20 Webinar suivant: Indexation avancée , texte et index géospatial • Prise en charge complète de texte permettant à un utilisateur d’indexer tout le contenu textuel dans leur base de données «comme Google» pour de la recherche sur un ensemble de données • Indexes géospatiaux qui permettent à un utilisateur de stocker des coordonnées géospatiales et d’effectuer des recherches sur la base de la proximité d'un point à un autre . Mercredi 13 Juillet, 14:00 CET.

Notas do Editor

  1. Who I am, how long have I been at MongoDB.
  2. Single index. N to M is 1 to 1.
  3. Candidate keys