SlideShare une entreprise Scribd logo
1  sur  42
Session 3 – Interaction
avec la base de données
Application Development Series
Bienvenue à la session 3
À PARTIR DE
15:00
CET
Application Development Series:
Session 3 – Interaction avec la
base de données
Présenté par
Tugdual Grall
Solutions Architect
MongoDB
Webinar Series:
Premiers Pas avec MongoDB
À PARTIR DE
MINUTES
05
About MetLife
MetLife, Inc. is a leading global provider of
insurance, annuities and employee benefit
programs, serving 90 million customers. Through
its subsidiaries and affiliates, MetLife holds leading
market positions in the United States, Japan, Latin
America, Asia, Europe and the Middle East.
Exemple d'utilisation du client
MetLife Leapfrogs Insurance Industry with MongoDB-Powered
Big Data Application
MetLife, Inc. selected MongoDB as the data engine for “The Wall”, an innovative customer
service application. Similar to the Facebook User Interface, The Wall provides a 360-
degree, consolidated view of MetLife customers, including policy details and transactions
across lines of business. The Wall improves customer satisfaction and boosts call centre
productivity.
MetLife built a working prototype in two weeks and was live in U.S. call centres in just 90
days. Currently, The Wall handles 45 million agreements with 140 million transactions.
By surfacing customer data in The Wall, MetLife has shown how global companies can
simultaneously leverage the data from 70+ existing systems with the flexibility of emerging
technology. The MetLife team employed both traditional and modern technologies,
exhibiting agility in applying solutions to dynamic needs.
Webinar Series:
Premiers Pas
avec MongoDB
Application
Development Series:
Session 3:
Interaction avec la
base de données
04
À PARTIR DE
MINUTES
Alcuni dei nostri clienti…
Webinar Series:
Premiers Pas
avec MongoDB
Application
Development Series:
Session 3:
Interaction avec la
base de données
03
À PARTIR DE
MINUTES
About Orange Digital
Orange Digital is a subsidiary of France Telecom -
Orange supplying digital services to EE in the UK
and Orange across Europe. Orange Digital maintains
the websites Orange, Orange World, and the Orange
Business site, as well as a number of EE‟s digital
assets.
Exemple d'utilisation du client
Managing such varied content is a mammoth undertaking, as
connection speeds increase and expectations grow
Under these circumstances, Orange Digital started to look for alternatives, both in terms of
database and delivery platform. After some deliberation, research and testing, the company
settled on abandoning hosting the data itself and instead moved to Amazon's cloud-based
web service.
Along with the move to Amazon, Orange Digital decided to use a non-relational database to
store content and metadata. After experimenting with several options Orange Digital chose
MongoDB due to its strong performance, ease of use but the decision was primarily due to
replication, auto sharding, failover and disaster recovery features which are especially relevant
on a cloud based infrastructure where hardware failures do happen. Orange Digital solutions
are designed to assume that failure will happen and must gracefully cope with failure.
"We tried several different databases, but the incredible performance, horizontal scalability
and automatic backup and failover functionality made MongoDB the natural choice for us -
and makes life easier for our developers," announced Orange.
02
Webinar Series:
Premiers Pas
avec MongoDB
Application
Development Series:
Session 3:
Interaction avec la
base de données
À PARTIR DE
MINUTES
Application Development Series:
Session 3 – Interaction avec la
base de données
Présenté par
Tugdual Grall
Solutions Architect
MongoDB
Webinar Series:
Premiers Pas avec MongoDB
À PARTIR DE
MINUTES
01
Application Development Series
Back to Basics
Interaction avec la base de données
Tugdual Grall
@tgrall
#MongoDBBasics
8
• Session Précédente : Rappel
• MongoDB Inserts & Queries
– ObjectId
– Récupération des Documents & Cursors
– Projections
• MongoDB Update
– Fixed Buckets
– Pre Aggregated Reports
• Write Concern
– Compromis : Durabilité / Performance
Agenda
9
• Virtual Genius Bar
– Utilisez la fenêtre de
chat
Q & A
Recap from last time….
11
• Architecture de l‟Application
– JSON / RESTful
– Basé sur Python
Architecture
Client-side
JSON
(eg AngularJS) (BSON)
Pymongo driver
Python web
app
HTTP(S) REST
12
• Design
• Articles
• Comments
• Interactions
• Users
Schema & Architecture
13
Modèle : Articles
• Creation d‟articles
• Insert
• Liste d‟articles
• Renvois d‟un Curseur
• Article Unique
{
'_id' : ObjectId(...),
'text': 'Article content…',
'date' : ISODate(...),
'title' : ‟Intro to MongoDB',
'author' : 'Dan Roberts',
'tags' : [ 'mongodb',
'database',
'nosql‟
]
}
Collection : Articles
METHODES
def get_article(article_id)
def get_articles():
def create_article():
14
Modèle : Comments
• Stockage des commentaires
• Récupération des
commentaires
• Ajout nouveau commentaire au
document
• „Bucketing‟
{
„_id‟ : ObjectId(..),
„article_id‟ : ObjectId(..),
„page‟ : 1,
„count‟ : 42
„comments‟ : [
{
„text‟ : „A great
article, helped me understand
schema design‟,
„date‟ : ISODate(..),
„author‟ : „johnsmith‟
},
…
}
Collection : Comments
METHODES
def add_comment(article_id):
def get_comments(article_id):
15
Modèle : Interactions
• Reporting
• Used for reporting on
articles
• Création de rapports
“pre-aggregé”
{
„_id‟ : ObjectId(..),
„article_id‟ : ObjectId(..),
„section‟ : „schema‟,
„date‟ : ISODate(..),
„daily‟: { „views‟ : 45,
„comments‟ : 150 }
„hours‟ : {
0 : { „views‟ : 10 },
1 : { „views‟ : 2 },
…
23 : { „views‟ : 14,
„comments‟ : 10 }
}
}
Collection : Interactions
METHODES def add_interaction(article_id, type):
Création / Requêtes
17
>db.articles.insert({
'text': 'Article content…‟,
'date' : ISODate(...),
'title' : ‟Intro to MongoDB‟,
'author' : 'Dan Roberts‟,
'tags' : [ 'mongodb',
'database',
'nosql‟
]
});
• Driver génère ObjectId() pour le _id
– Si non spécifié par l‟application
– 12 octets- 4-octets epoch, 3-octets machine id, a 2-octets process id, 3-octets
counter.
Ajout de documents
18
$gt, $gte, $in, $lt, $lte, $ne, $nin
• Utilisé pour requêter la base de données
• Logique: $or, $and, $not, $nor Element: $exists, $type
• Evalué: $mod, $regex, $where Geospatial: $geoWithin, $geoIntersects, $near, $nearSphere
Opérateurs: Comparaison
db.articles.find( { 'title' : ‟Intro to MongoDB‟ } )
db.articles.find( { ‟date' : { „$lt‟ :
{ISODate("2014-02-19T00:00:00.000Z") }} )
db.articles.find( { „tags‟ : { „$in‟ : [„nosql‟, „database‟] } } );
19
• Find retourne un curseur
– Utilisé pour naviguer dans le résultat
– Un curseur a plusieurs méthodes
Curseurs
>var cursor = db.articles.find ( { ‟author' : ‟Tug Grall‟ } )
>cursor.hasNext()
true
>cursor.next()
{ '_id' : ObjectId(...),
'text': 'Article content…‟,
'date' : ISODate(...),
'title' : ‟Intro to MongoDB‟,
'author' : 'Dan Roberts‟,
'tags' : [ 'mongodb', 'database‟, 'nosql’ ]
}
20
• Retourne uniquement certains attributs
– Booléen 0/1 pour sélectionner les attributs
– Plus efficace
Projections
>var cursor = db.articles.find( { ‟author' : ‟Tug Grall‟ } , {‘_id’:0, ‘title’:1})
>cursor.hasNext()
true
>cursor.next()
{ "title" : "Intro to MongoDB" }
Mises à jour
22
$each, $slice, $sort, $inc, $push
$inc, $rename, $setOnInsert, $set, $unset, $max, $min
$, $addToSet, $pop, $pullAll, $pull, $pushAll, $push
$each, $slice, $sort
Opérateur : Update
>db.articles.update(
{ '_id' : ObjectId(...)},
{ '$push' :
{'comments' : „Great
article!’ }
}
)
{ 'text': 'Article content…‟
'date' : ISODate(...),
'title' : ‟Intro to MongoDB‟,
'author' : ‟Tug Grall‟,
'tags' : ['mongodb',
'database‟,'nosql’ ],
’comments' :
[‘Great article!’ ]
}
23
Ajout d’élément à un tableau
$push, $each, $slice
Opérateur : Update
>db.articles.update(
{ '_id' : ObjectId(...)},
{ '$push' : {'comments' :
{
'$each' : [„Excellent‟],
'$slice' : -3}},
})
{ 'text': 'Article content…‟
'date' : ISODate(...),
'title' : ‟Intro to MongoDB‟,
'author' : 'Dan Roberts‟,
'tags' : ['mongodb',
'database‟,'nosql’ ],
’comments' :
[‘Great article!’,
‘More please’, ‘Excellent’ ]
}
24
• Ajout de commentaires dans un document (max : 10 - bucket).
• Création d‟un nouveau.
• Utilisation de {upsert: true} .
Opérateur : Update- Bucketing
>db.comments.update(
{„c‟: {„$lt‟:10}},
{
„$inc‟ : {c:1},
'$push' : {
'comments' :
„Excellent‟ }
},
{ upsert : true }
)
{
„_id‟ : ObjectId( … )
„c‟ : 3,
’comments' :
[‘Great article!’,
‘More please’,
‘Excellent’ ]
}
25
Analytique– Pre-Agrégation
• Reporting
• Rapports Pré-agregés
{
„_id‟ : ObjectId(..),
„article_id‟ : ObjectId(..),
„section‟ : „schema‟,
„date‟ : ISODate(..),
„daily‟: { „views‟ : 45,
„comments‟ : 150 }
„hours‟ : {
0 : { „views‟ : 10 },
1 : { „views‟ : 2 },
…
23 : { „views‟ : 14,
„comments‟ : 10 }
}
}
Collections : Interactions
METHODE def add_interaction(article_id, type):
26
• Utilisation de $inc pour incrémenter plusieurs compteurs.
• Opération atomique
• Incrémentation des compteurs par jour et heure
Compteurs : Incrément
>db.interactions.update(
{„article_id‟ : ObjectId(..)},
{
„$inc‟ : {
„daily.views‟:1,
„daily.comments‟:1
„hours.8.views‟:1
„hours.8.comments‟:1
}
)
{
„_id‟ : ObjectId(..),
„article_id‟ : ObjectId(..),
„section‟ : „schema‟,
„date‟ : ISODate(..),
„daily‟: { „views‟ : 45,
„comments‟ : 150 }
„hours‟ : {
0 : { „views‟ : 10 },
1 : { „views‟ : 2 },
…
23 : { „views‟ : 14,
„comments‟ : 10 }
}
}
27
• Création de nouveaux compteurs
Compteurs : Incrément (2)
>db.interactions.update(
{„article_id‟ : ObjectId(..)},
{
„$inc‟ : {
„daily.views‟:1,
„daily.comments‟:1,
„hours.8.views‟:1,
„hours.8.comments‟:1,
‘referrers.bing’ : 1
}
)
{
„_id‟ : ObjectId(..),
„article_id‟ : ObjectId(..),
„section‟ : „schema‟,
„date‟ : ISODate(..),
„daily‟: { „views‟ : 45,
„comments‟ : 150 }
„hours‟ : {
…..
}
„referrers‟ : {
„google‟ : 27
}
}
28
• Increment new counters
Compteurs : Incrément (2)
>db.interactions.update(
{„article_id‟ : ObjectId(..)},
{
„$inc‟ : {
„daily.views‟:1,
„daily.comments‟:1,
„hours.8.views‟:1,
„hours.8.comments‟:1,
‘referrers.bing’ : 1
}
)
{
„_id‟ : ObjectId(..),
„article_id‟ : ObjectId(..),
„section‟ : „schema‟,
„date‟ : ISODate(..),
„daily‟: { „views‟ : 45,
„comments‟ : 150 }
„hours‟ : {
…..
}
„referrers‟ : {
„google‟ : 27,
‘bing’ : 1
}
}
Durabilité
30
Durabilité
• Avec MongoDB, plusieurs options
• Memoire/RAM
• Disque (primaire)
• Plusieurs serveur (replicats)
• Write Concerns
• Retour sur le status de l‟opération d‟écriture
• getLastError() appelé par le driver
• Compromis
• Latence
31
Unacknowledged
32
MongoDB Acknowledged
Default Write Concern
33
Wait for Journal Sync
34
Replica Sets
• Replica Set – 2 copies ou plus
• Tolérant aux pannes
• Répond à plusieurs contraintes:
- High Availability
- Disaster Recovery
- Maintenance
35
Wait for Replication
Résumé
37
• Interactions
– Requtes et projections
– Inserts & Upserts
– Opérateurs : Update
– Bucketing
– Rapports pre-agrégés
• Base pour les rapport analytiques
Résumé
38
– Indexation
• Stratégies/Options
• Optimisation
– Text Search
– Geo Spatial
– Query Profiler
Prochaine Session – 9 Avril
Tweet vos questions à
#mongoDBBasics
Risorsa WEBSITE URL
Enterprise Download mongodb.com/download
Training Online Gratuito education.mongodb.com
Webinars e Events mongodb.com/events
White Paper mongodb.com/white-papers
Casi d‟Uso mongodb.com/customers
Presentazioni mongodb.com/presentations
Documentazione docs.mongodb.org
2014 03-26-appdevseries-session3-interactingwiththedatabase-fr-phpapp01

Contenu connexe

Tendances

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é
 
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
 
Découverte de Elastic search
Découverte de Elastic searchDécouverte de Elastic search
Découverte de Elastic searchJEMLI Fathi
 
Étude comparative sur la valorisation du big data pour les contenus audiovisuels
Étude comparative sur la valorisation du big data pour les contenus audiovisuelsÉtude comparative sur la valorisation du big data pour les contenus audiovisuels
Étude comparative sur la valorisation du big data pour les contenus audiovisuelsThomas Malice
 
Guide (un tout petit peu) pratique (et totalement subjectif) du stream proces...
Guide (un tout petit peu) pratique (et totalement subjectif) du stream proces...Guide (un tout petit peu) pratique (et totalement subjectif) du stream proces...
Guide (un tout petit peu) pratique (et totalement subjectif) du stream proces...Bruno Bonnin
 
Présentation Big Data et REX Hadoop
Présentation Big Data et REX HadoopPrésentation Big Data et REX Hadoop
Présentation Big Data et REX HadoopJoseph Glorieux
 

Tendances (6)

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
 
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…
 
Découverte de Elastic search
Découverte de Elastic searchDécouverte de Elastic search
Découverte de Elastic search
 
Étude comparative sur la valorisation du big data pour les contenus audiovisuels
Étude comparative sur la valorisation du big data pour les contenus audiovisuelsÉtude comparative sur la valorisation du big data pour les contenus audiovisuels
Étude comparative sur la valorisation du big data pour les contenus audiovisuels
 
Guide (un tout petit peu) pratique (et totalement subjectif) du stream proces...
Guide (un tout petit peu) pratique (et totalement subjectif) du stream proces...Guide (un tout petit peu) pratique (et totalement subjectif) du stream proces...
Guide (un tout petit peu) pratique (et totalement subjectif) du stream proces...
 
Présentation Big Data et REX Hadoop
Présentation Big Data et REX HadoopPrésentation Big Data et REX Hadoop
Présentation Big Data et REX Hadoop
 

En vedette

Webinar: Serie Operazioni per la vostra applicazione - Sessione 6 - Installar...
Webinar: Serie Operazioni per la vostra applicazione - Sessione 6 - Installar...Webinar: Serie Operazioni per la vostra applicazione - Sessione 6 - Installar...
Webinar: Serie Operazioni per la vostra applicazione - Sessione 6 - Installar...MongoDB
 
MongoDB Memory Management Demystified
MongoDB Memory Management DemystifiedMongoDB Memory Management Demystified
MongoDB Memory Management DemystifiedMongoDB
 
Webinar: Compliance and Data Protection in the Big Data Age: MongoDB Security...
Webinar: Compliance and Data Protection in the Big Data Age: MongoDB Security...Webinar: Compliance and Data Protection in the Big Data Age: MongoDB Security...
Webinar: Compliance and Data Protection in the Big Data Age: MongoDB Security...MongoDB
 
Capacity Planning For Your Growing MongoDB Cluster
Capacity Planning For Your Growing MongoDB ClusterCapacity Planning For Your Growing MongoDB Cluster
Capacity Planning For Your Growing MongoDB ClusterMongoDB
 
Hacking MongoDB at RelateIQ, A Salesforce Company
Hacking MongoDB at RelateIQ, A Salesforce CompanyHacking MongoDB at RelateIQ, A Salesforce Company
Hacking MongoDB at RelateIQ, A Salesforce CompanyMongoDB
 
An Elastic Metadata Store for eBay’s Media Platform
An Elastic Metadata Store for eBay’s Media PlatformAn Elastic Metadata Store for eBay’s Media Platform
An Elastic Metadata Store for eBay’s Media PlatformMongoDB
 
MongoDB for Time Series Data: Schema Design
MongoDB for Time Series Data: Schema DesignMongoDB for Time Series Data: Schema Design
MongoDB for Time Series Data: Schema DesignMongoDB
 

En vedette (7)

Webinar: Serie Operazioni per la vostra applicazione - Sessione 6 - Installar...
Webinar: Serie Operazioni per la vostra applicazione - Sessione 6 - Installar...Webinar: Serie Operazioni per la vostra applicazione - Sessione 6 - Installar...
Webinar: Serie Operazioni per la vostra applicazione - Sessione 6 - Installar...
 
MongoDB Memory Management Demystified
MongoDB Memory Management DemystifiedMongoDB Memory Management Demystified
MongoDB Memory Management Demystified
 
Webinar: Compliance and Data Protection in the Big Data Age: MongoDB Security...
Webinar: Compliance and Data Protection in the Big Data Age: MongoDB Security...Webinar: Compliance and Data Protection in the Big Data Age: MongoDB Security...
Webinar: Compliance and Data Protection in the Big Data Age: MongoDB Security...
 
Capacity Planning For Your Growing MongoDB Cluster
Capacity Planning For Your Growing MongoDB ClusterCapacity Planning For Your Growing MongoDB Cluster
Capacity Planning For Your Growing MongoDB Cluster
 
Hacking MongoDB at RelateIQ, A Salesforce Company
Hacking MongoDB at RelateIQ, A Salesforce CompanyHacking MongoDB at RelateIQ, A Salesforce Company
Hacking MongoDB at RelateIQ, A Salesforce Company
 
An Elastic Metadata Store for eBay’s Media Platform
An Elastic Metadata Store for eBay’s Media PlatformAn Elastic Metadata Store for eBay’s Media Platform
An Elastic Metadata Store for eBay’s Media Platform
 
MongoDB for Time Series Data: Schema Design
MongoDB for Time Series Data: Schema DesignMongoDB for Time Series Data: Schema Design
MongoDB for Time Series Data: Schema Design
 

Similaire à 2014 03-26-appdevseries-session3-interactingwiththedatabase-fr-phpapp01

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
 
Morning tech #2 - Démarche performance slides
Morning tech #2 - Démarche performance slidesMorning tech #2 - Démarche performance slides
Morning tech #2 - Démarche performance slidesOxalide
 
Oxalide Morning tech #2 - démarche performance
Oxalide Morning tech #2 - démarche performanceOxalide Morning tech #2 - démarche performance
Oxalide Morning tech #2 - démarche performanceLudovic Piot
 
Pres azure paas tdf -rex-hager-vincent thavonekham-regional director-azug f...
Pres azure   paas tdf -rex-hager-vincent thavonekham-regional director-azug f...Pres azure   paas tdf -rex-hager-vincent thavonekham-regional director-azug f...
Pres azure paas tdf -rex-hager-vincent thavonekham-regional director-azug f...FactoVia
 
Denodo, pilier central de votre stratégie API
Denodo, pilier central de votre stratégie APIDenodo, pilier central de votre stratégie API
Denodo, pilier central de votre stratégie APIDenodo
 
Sido 2017 : Vincent Thavonekham, MVP azure et Regional Director, VISEO, Retou...
Sido 2017 : Vincent Thavonekham, MVP azure et Regional Director, VISEO, Retou...Sido 2017 : Vincent Thavonekham, MVP azure et Regional Director, VISEO, Retou...
Sido 2017 : Vincent Thavonekham, MVP azure et Regional Director, VISEO, Retou...FactoVia
 
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
 
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 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
 
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
 
Stage de fin d’études – dotcloud
Stage de fin d’études – dotcloudStage de fin d’études – dotcloud
Stage de fin d’études – dotcloudJoffrey Fu Hrer
 
Stage de fin d’études – dotcloud
Stage de fin d’études – dotcloudStage de fin d’études – dotcloud
Stage de fin d’études – dotcloudJoffrey Fu Hrer
 
Devoxx: Tribulation d'un développeur sur le Cloud
Devoxx: Tribulation d'un développeur sur le CloudDevoxx: Tribulation d'un développeur sur le Cloud
Devoxx: Tribulation d'un développeur sur le CloudTugdual Grall
 
Event: Petit-déjeuner MongoDB France
Event: Petit-déjeuner MongoDB FranceEvent: Petit-déjeuner MongoDB France
Event: Petit-déjeuner MongoDB FranceMongoDB
 
D’un modèle d'IA dans un notebook à un service temps réel : architecturons !
D’un modèle d'IA dans un notebook à un service temps réel : architecturons ! D’un modèle d'IA dans un notebook à un service temps réel : architecturons !
D’un modèle d'IA dans un notebook à un service temps réel : architecturons ! Marie-Alice Blete
 
ASP.NET MVC, Web API & KnockoutJS
ASP.NET MVC, Web API & KnockoutJSASP.NET MVC, Web API & KnockoutJS
ASP.NET MVC, Web API & KnockoutJSRenaud Dumont
 
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
 
Retour d'expérience Large IoT project / BigData : détail du cas réel de Hager...
Retour d'expérience Large IoT project / BigData : détail du cas réel de Hager...Retour d'expérience Large IoT project / BigData : détail du cas réel de Hager...
Retour d'expérience Large IoT project / BigData : détail du cas réel de Hager...FactoVia
 

Similaire à 2014 03-26-appdevseries-session3-interactingwiththedatabase-fr-phpapp01 (20)

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.
 
Morning tech #2 - Démarche performance slides
Morning tech #2 - Démarche performance slidesMorning tech #2 - Démarche performance slides
Morning tech #2 - Démarche performance slides
 
Oxalide Morning tech #2 - démarche performance
Oxalide Morning tech #2 - démarche performanceOxalide Morning tech #2 - démarche performance
Oxalide Morning tech #2 - démarche performance
 
Pres azure paas tdf -rex-hager-vincent thavonekham-regional director-azug f...
Pres azure   paas tdf -rex-hager-vincent thavonekham-regional director-azug f...Pres azure   paas tdf -rex-hager-vincent thavonekham-regional director-azug f...
Pres azure paas tdf -rex-hager-vincent thavonekham-regional director-azug f...
 
Mongo db with C#
Mongo db with C#Mongo db with C#
Mongo db with C#
 
Denodo, pilier central de votre stratégie API
Denodo, pilier central de votre stratégie APIDenodo, pilier central de votre stratégie API
Denodo, pilier central de votre stratégie API
 
Sido 2017 : Vincent Thavonekham, MVP azure et Regional Director, VISEO, Retou...
Sido 2017 : Vincent Thavonekham, MVP azure et Regional Director, VISEO, Retou...Sido 2017 : Vincent Thavonekham, MVP azure et Regional Director, VISEO, Retou...
Sido 2017 : Vincent Thavonekham, MVP azure et Regional Director, VISEO, Retou...
 
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
 
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 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
 
CV_Bilel CHAOUADI
CV_Bilel CHAOUADICV_Bilel CHAOUADI
CV_Bilel CHAOUADI
 
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
 
Stage de fin d’études – dotcloud
Stage de fin d’études – dotcloudStage de fin d’études – dotcloud
Stage de fin d’études – dotcloud
 
Stage de fin d’études – dotcloud
Stage de fin d’études – dotcloudStage de fin d’études – dotcloud
Stage de fin d’études – dotcloud
 
Devoxx: Tribulation d'un développeur sur le Cloud
Devoxx: Tribulation d'un développeur sur le CloudDevoxx: Tribulation d'un développeur sur le Cloud
Devoxx: Tribulation d'un développeur sur le Cloud
 
Event: Petit-déjeuner MongoDB France
Event: Petit-déjeuner MongoDB FranceEvent: Petit-déjeuner MongoDB France
Event: Petit-déjeuner MongoDB France
 
D’un modèle d'IA dans un notebook à un service temps réel : architecturons !
D’un modèle d'IA dans un notebook à un service temps réel : architecturons ! D’un modèle d'IA dans un notebook à un service temps réel : architecturons !
D’un modèle d'IA dans un notebook à un service temps réel : architecturons !
 
ASP.NET MVC, Web API & KnockoutJS
ASP.NET MVC, Web API & KnockoutJSASP.NET MVC, Web API & KnockoutJS
ASP.NET MVC, Web API & KnockoutJS
 
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
 
Retour d'expérience Large IoT project / BigData : détail du cas réel de Hager...
Retour d'expérience Large IoT project / BigData : détail du cas réel de Hager...Retour d'expérience Large IoT project / BigData : détail du cas réel de Hager...
Retour d'expérience Large IoT project / BigData : détail du cas réel de Hager...
 

Plus 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
 

Plus 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...
 

2014 03-26-appdevseries-session3-interactingwiththedatabase-fr-phpapp01

  • 1. Session 3 – Interaction avec la base de données Application Development Series Bienvenue à la session 3 À PARTIR DE 15:00 CET
  • 2. Application Development Series: Session 3 – Interaction avec la base de données Présenté par Tugdual Grall Solutions Architect MongoDB Webinar Series: Premiers Pas avec MongoDB À PARTIR DE MINUTES 05
  • 3. About MetLife MetLife, Inc. is a leading global provider of insurance, annuities and employee benefit programs, serving 90 million customers. Through its subsidiaries and affiliates, MetLife holds leading market positions in the United States, Japan, Latin America, Asia, Europe and the Middle East. Exemple d'utilisation du client MetLife Leapfrogs Insurance Industry with MongoDB-Powered Big Data Application MetLife, Inc. selected MongoDB as the data engine for “The Wall”, an innovative customer service application. Similar to the Facebook User Interface, The Wall provides a 360- degree, consolidated view of MetLife customers, including policy details and transactions across lines of business. The Wall improves customer satisfaction and boosts call centre productivity. MetLife built a working prototype in two weeks and was live in U.S. call centres in just 90 days. Currently, The Wall handles 45 million agreements with 140 million transactions. By surfacing customer data in The Wall, MetLife has shown how global companies can simultaneously leverage the data from 70+ existing systems with the flexibility of emerging technology. The MetLife team employed both traditional and modern technologies, exhibiting agility in applying solutions to dynamic needs. Webinar Series: Premiers Pas avec MongoDB Application Development Series: Session 3: Interaction avec la base de données 04 À PARTIR DE MINUTES
  • 4. Alcuni dei nostri clienti… Webinar Series: Premiers Pas avec MongoDB Application Development Series: Session 3: Interaction avec la base de données 03 À PARTIR DE MINUTES
  • 5. About Orange Digital Orange Digital is a subsidiary of France Telecom - Orange supplying digital services to EE in the UK and Orange across Europe. Orange Digital maintains the websites Orange, Orange World, and the Orange Business site, as well as a number of EE‟s digital assets. Exemple d'utilisation du client Managing such varied content is a mammoth undertaking, as connection speeds increase and expectations grow Under these circumstances, Orange Digital started to look for alternatives, both in terms of database and delivery platform. After some deliberation, research and testing, the company settled on abandoning hosting the data itself and instead moved to Amazon's cloud-based web service. Along with the move to Amazon, Orange Digital decided to use a non-relational database to store content and metadata. After experimenting with several options Orange Digital chose MongoDB due to its strong performance, ease of use but the decision was primarily due to replication, auto sharding, failover and disaster recovery features which are especially relevant on a cloud based infrastructure where hardware failures do happen. Orange Digital solutions are designed to assume that failure will happen and must gracefully cope with failure. "We tried several different databases, but the incredible performance, horizontal scalability and automatic backup and failover functionality made MongoDB the natural choice for us - and makes life easier for our developers," announced Orange. 02 Webinar Series: Premiers Pas avec MongoDB Application Development Series: Session 3: Interaction avec la base de données À PARTIR DE MINUTES
  • 6. Application Development Series: Session 3 – Interaction avec la base de données Présenté par Tugdual Grall Solutions Architect MongoDB Webinar Series: Premiers Pas avec MongoDB À PARTIR DE MINUTES 01
  • 7. Application Development Series Back to Basics Interaction avec la base de données Tugdual Grall @tgrall #MongoDBBasics
  • 8. 8 • Session Précédente : Rappel • MongoDB Inserts & Queries – ObjectId – Récupération des Documents & Cursors – Projections • MongoDB Update – Fixed Buckets – Pre Aggregated Reports • Write Concern – Compromis : Durabilité / Performance Agenda
  • 9. 9 • Virtual Genius Bar – Utilisez la fenêtre de chat Q & A
  • 10. Recap from last time….
  • 11. 11 • Architecture de l‟Application – JSON / RESTful – Basé sur Python Architecture Client-side JSON (eg AngularJS) (BSON) Pymongo driver Python web app HTTP(S) REST
  • 12. 12 • Design • Articles • Comments • Interactions • Users Schema & Architecture
  • 13. 13 Modèle : Articles • Creation d‟articles • Insert • Liste d‟articles • Renvois d‟un Curseur • Article Unique { '_id' : ObjectId(...), 'text': 'Article content…', 'date' : ISODate(...), 'title' : ‟Intro to MongoDB', 'author' : 'Dan Roberts', 'tags' : [ 'mongodb', 'database', 'nosql‟ ] } Collection : Articles METHODES def get_article(article_id) def get_articles(): def create_article():
  • 14. 14 Modèle : Comments • Stockage des commentaires • Récupération des commentaires • Ajout nouveau commentaire au document • „Bucketing‟ { „_id‟ : ObjectId(..), „article_id‟ : ObjectId(..), „page‟ : 1, „count‟ : 42 „comments‟ : [ { „text‟ : „A great article, helped me understand schema design‟, „date‟ : ISODate(..), „author‟ : „johnsmith‟ }, … } Collection : Comments METHODES def add_comment(article_id): def get_comments(article_id):
  • 15. 15 Modèle : Interactions • Reporting • Used for reporting on articles • Création de rapports “pre-aggregé” { „_id‟ : ObjectId(..), „article_id‟ : ObjectId(..), „section‟ : „schema‟, „date‟ : ISODate(..), „daily‟: { „views‟ : 45, „comments‟ : 150 } „hours‟ : { 0 : { „views‟ : 10 }, 1 : { „views‟ : 2 }, … 23 : { „views‟ : 14, „comments‟ : 10 } } } Collection : Interactions METHODES def add_interaction(article_id, type):
  • 17. 17 >db.articles.insert({ 'text': 'Article content…‟, 'date' : ISODate(...), 'title' : ‟Intro to MongoDB‟, 'author' : 'Dan Roberts‟, 'tags' : [ 'mongodb', 'database', 'nosql‟ ] }); • Driver génère ObjectId() pour le _id – Si non spécifié par l‟application – 12 octets- 4-octets epoch, 3-octets machine id, a 2-octets process id, 3-octets counter. Ajout de documents
  • 18. 18 $gt, $gte, $in, $lt, $lte, $ne, $nin • Utilisé pour requêter la base de données • Logique: $or, $and, $not, $nor Element: $exists, $type • Evalué: $mod, $regex, $where Geospatial: $geoWithin, $geoIntersects, $near, $nearSphere Opérateurs: Comparaison db.articles.find( { 'title' : ‟Intro to MongoDB‟ } ) db.articles.find( { ‟date' : { „$lt‟ : {ISODate("2014-02-19T00:00:00.000Z") }} ) db.articles.find( { „tags‟ : { „$in‟ : [„nosql‟, „database‟] } } );
  • 19. 19 • Find retourne un curseur – Utilisé pour naviguer dans le résultat – Un curseur a plusieurs méthodes Curseurs >var cursor = db.articles.find ( { ‟author' : ‟Tug Grall‟ } ) >cursor.hasNext() true >cursor.next() { '_id' : ObjectId(...), 'text': 'Article content…‟, 'date' : ISODate(...), 'title' : ‟Intro to MongoDB‟, 'author' : 'Dan Roberts‟, 'tags' : [ 'mongodb', 'database‟, 'nosql’ ] }
  • 20. 20 • Retourne uniquement certains attributs – Booléen 0/1 pour sélectionner les attributs – Plus efficace Projections >var cursor = db.articles.find( { ‟author' : ‟Tug Grall‟ } , {‘_id’:0, ‘title’:1}) >cursor.hasNext() true >cursor.next() { "title" : "Intro to MongoDB" }
  • 22. 22 $each, $slice, $sort, $inc, $push $inc, $rename, $setOnInsert, $set, $unset, $max, $min $, $addToSet, $pop, $pullAll, $pull, $pushAll, $push $each, $slice, $sort Opérateur : Update >db.articles.update( { '_id' : ObjectId(...)}, { '$push' : {'comments' : „Great article!’ } } ) { 'text': 'Article content…‟ 'date' : ISODate(...), 'title' : ‟Intro to MongoDB‟, 'author' : ‟Tug Grall‟, 'tags' : ['mongodb', 'database‟,'nosql’ ], ’comments' : [‘Great article!’ ] }
  • 23. 23 Ajout d’élément à un tableau $push, $each, $slice Opérateur : Update >db.articles.update( { '_id' : ObjectId(...)}, { '$push' : {'comments' : { '$each' : [„Excellent‟], '$slice' : -3}}, }) { 'text': 'Article content…‟ 'date' : ISODate(...), 'title' : ‟Intro to MongoDB‟, 'author' : 'Dan Roberts‟, 'tags' : ['mongodb', 'database‟,'nosql’ ], ’comments' : [‘Great article!’, ‘More please’, ‘Excellent’ ] }
  • 24. 24 • Ajout de commentaires dans un document (max : 10 - bucket). • Création d‟un nouveau. • Utilisation de {upsert: true} . Opérateur : Update- Bucketing >db.comments.update( {„c‟: {„$lt‟:10}}, { „$inc‟ : {c:1}, '$push' : { 'comments' : „Excellent‟ } }, { upsert : true } ) { „_id‟ : ObjectId( … ) „c‟ : 3, ’comments' : [‘Great article!’, ‘More please’, ‘Excellent’ ] }
  • 25. 25 Analytique– Pre-Agrégation • Reporting • Rapports Pré-agregés { „_id‟ : ObjectId(..), „article_id‟ : ObjectId(..), „section‟ : „schema‟, „date‟ : ISODate(..), „daily‟: { „views‟ : 45, „comments‟ : 150 } „hours‟ : { 0 : { „views‟ : 10 }, 1 : { „views‟ : 2 }, … 23 : { „views‟ : 14, „comments‟ : 10 } } } Collections : Interactions METHODE def add_interaction(article_id, type):
  • 26. 26 • Utilisation de $inc pour incrémenter plusieurs compteurs. • Opération atomique • Incrémentation des compteurs par jour et heure Compteurs : Incrément >db.interactions.update( {„article_id‟ : ObjectId(..)}, { „$inc‟ : { „daily.views‟:1, „daily.comments‟:1 „hours.8.views‟:1 „hours.8.comments‟:1 } ) { „_id‟ : ObjectId(..), „article_id‟ : ObjectId(..), „section‟ : „schema‟, „date‟ : ISODate(..), „daily‟: { „views‟ : 45, „comments‟ : 150 } „hours‟ : { 0 : { „views‟ : 10 }, 1 : { „views‟ : 2 }, … 23 : { „views‟ : 14, „comments‟ : 10 } } }
  • 27. 27 • Création de nouveaux compteurs Compteurs : Incrément (2) >db.interactions.update( {„article_id‟ : ObjectId(..)}, { „$inc‟ : { „daily.views‟:1, „daily.comments‟:1, „hours.8.views‟:1, „hours.8.comments‟:1, ‘referrers.bing’ : 1 } ) { „_id‟ : ObjectId(..), „article_id‟ : ObjectId(..), „section‟ : „schema‟, „date‟ : ISODate(..), „daily‟: { „views‟ : 45, „comments‟ : 150 } „hours‟ : { ….. } „referrers‟ : { „google‟ : 27 } }
  • 28. 28 • Increment new counters Compteurs : Incrément (2) >db.interactions.update( {„article_id‟ : ObjectId(..)}, { „$inc‟ : { „daily.views‟:1, „daily.comments‟:1, „hours.8.views‟:1, „hours.8.comments‟:1, ‘referrers.bing’ : 1 } ) { „_id‟ : ObjectId(..), „article_id‟ : ObjectId(..), „section‟ : „schema‟, „date‟ : ISODate(..), „daily‟: { „views‟ : 45, „comments‟ : 150 } „hours‟ : { ….. } „referrers‟ : { „google‟ : 27, ‘bing’ : 1 } }
  • 30. 30 Durabilité • Avec MongoDB, plusieurs options • Memoire/RAM • Disque (primaire) • Plusieurs serveur (replicats) • Write Concerns • Retour sur le status de l‟opération d‟écriture • getLastError() appelé par le driver • Compromis • Latence
  • 34. 34 Replica Sets • Replica Set – 2 copies ou plus • Tolérant aux pannes • Répond à plusieurs contraintes: - High Availability - Disaster Recovery - Maintenance
  • 37. 37 • Interactions – Requtes et projections – Inserts & Upserts – Opérateurs : Update – Bucketing – Rapports pre-agrégés • Base pour les rapport analytiques Résumé
  • 38. 38 – Indexation • Stratégies/Options • Optimisation – Text Search – Geo Spatial – Query Profiler Prochaine Session – 9 Avril
  • 39.
  • 40. Tweet vos questions à #mongoDBBasics
  • 41. Risorsa WEBSITE URL Enterprise Download mongodb.com/download Training Online Gratuito education.mongodb.com Webinars e Events mongodb.com/events White Paper mongodb.com/white-papers Casi d‟Uso mongodb.com/customers Presentazioni mongodb.com/presentations Documentazione docs.mongodb.org

Notes de l'éditeur

  1. Not really fire and forget. This return arrow is to confirm that the network successfully transferred the packet(s) of data.This confirms that the TCP ACK response was received.
  2. Presenter should mention:Default is w:1w:majority is what most people should use for durability. Majority is a special token here signifying more than half of the nodes in the set have acknowledged the write.