SlideShare une entreprise Scribd logo
Votre première app MongoDB
Nic Cottrell, Ingénieur Services Techniques, MongoDB
4 décembre 2018
Paris, France
Les bases de MongoDB:
● Collections,
● Documents JSON,
● CRUD,
● Indexes,
● Aggregation Framework
Visualiser les données MongoDB
Application simple sur le stack MEAN
Agenda
Nicholas Cottrell
Technical Services Engineer
nicholas.cottrell@mongodb.com
Normandie, France
stackoverflow.com/users/543315/nic-cottrell
github.com/niccottrell/mongodb-paris-2018
Un peu d'histoire
Dynamique
et Naturel
Rigide et
Normalisé
{
"_id": "Emp123",
"nom": "Jean Leblanc",
"titre": "Dev superstar",
"telephones": [ "0123456789", "063456789"]
}
Id (VARCHAR) Nom (VARCHAR)
Emp123 Jean Leblanc
Id (VARCHAR) PhoneId (Int)
Emp123 456
Emp123 567
PhoneId Phone (VARCHAR)
456 0123456789
567 063456789
vs
{
"_id": 123,
"nom": "Jean Leblanc",
"hps": NumberDecimal("37.5"),
"telephones": [ "0123456789", "063456789"],
"commence": ISODate("2016-10-05"),
"bureau": {
"ville": "Paris",
"lieu": { type: "Point",
coordinates: [2.3333, 48.86] }
},
"equipe": [ { "id": 189, "nom": "Camille Martin"},
{ "id": 256, "nom": "Maxime Lefevre" }, ... ]
}
Les documents - structures de données riches
Champs
Nombre entier
Chaîne de
caractères
Géo-localisation
Nombre à virgule flottante
Tableau de
sous-documents
Date
Décimal
{
"_id": 123,
"nom": "Jean Leblanc",
"hps": NumberDecimal("37.5"),
"telephones": [ "0123456789", "063456789"],
"commence": ISODate("2016-10-05"),
"bureau": {
"ville": "Paris",
"lieu": { type: "Point",
coordinates: [2.3333, 48.86] }
},
"equipe": [ { "id": 189, "nom": "Camille Martin"},
{ "id": 256, "nom": "Maxime Lefevre" }, ... ]
...
Les documents - structures de données riches
Champs
Nombre entier
Chaîne de
caractères
Géo-localisation
Nombre à virgule flottante
Tableau de
sous-documents
Interroger et indexer des
données à n'importe quel
niveau
Date
Décimal
{
"_id": 284,
"nom": "Melanie Mercier"
"titre": "Developpeur senior"
"commence": ISODate("2017-06-11")
"competences": ["java", "nodejs", "spring data"],
"device": "MacBook Pro 15",
...
}
Les documents sont flexibles
{
"_id": 123,
"nom": "Jean Leblanc"
"titre": "Chef superstar"
"telephones": [ "0123456789", "063456789"]
"commence": ISODate("2016-10-05")
…
}
Schéma polymorphes - aligné avec les principes de la POO
{
"_id": 284,
"nom": "Melanie Mercier"
"titre": "Developpeur senior"
"commence": ISODate("2017-06-11")
"competences": ["java", "nodejs", "spring data"],
"device": "MacBook Pro 15",
...
}
Les documents sont flexibles
{
"_id": 123,
"nom": "Jean Leblanc"
"titre": "Chef superstar"
"telephones": [ "0123456789", "063456789"]
"commence": ISODate("2016-10-05")
…
}
Schéma polymorphes - aligné avec les principes de la POO
db.staff.find({titre: /^Developpeur/}, {nom: 1, competences: 1})
SQL vs NoSQL
BdD relationnelle MongoDB
Gouvernance des
données
Validation du document et
Schéma JSON
Triggers Change Streams (3.6+)
Jointures $lookup (externe gauche)
Index et vues ✔ et ✔
GROUP BY Framework d'agrégation
SQL vs NoSQL
BdD relationnelle MongoDB
Gouvernance des
données
Validation du document et
Schéma JSON
Triggers Change Streams (3.6+)
Jointures $lookup (externe gauche)
Index et vues ✔ et ✔
GROUP BY Framework d'agrégation
NoSQL MongoDB
Haute disponibilité Replica Sets
Scalabilité Sharding
Standalone / Local dev
Standalone
Replica Sets
Cluster shardé
MongoDB - le meilleur des deux mondes
Fondations du SGBDR Avantages de NoSQL
Langage d'interrogation
expressif et index secondaires
Intégrité des données
Gestion d'entreprise et
intégrations
La flexibilité
Évolutivité et performance
Déploiement global et
toujours disponible
#1 BdD à la croissance
la plus rapide + de 30 millions téléchargements
uniques
4e BdD la plus populaire + de 5.000 clients payants
+ de 50.000 membres du groupe
d'utilisateurs MongoDB 75% clients du
Global 500
+ de 500.000 étudiants en ligne + de 3.000 clients
Atlas
Développement local
npm install mongodb --save
mongod --dbpath /data
Télécharger Compass
mongod
Écriture de données
Compass
Trouvez des restaurants à moins de 1 km du métro
Pigalle qui servent la cuisine japonaise
{
"name": "Puce",
"telephone": "0953482975",
"site": "http://ilovepuce.com/",
"code_postal": "75009",
"location": {
"type": "Point",
"coordinates": [2.33761, 48.8834]
},
"cuisine": ["japonaise", "mexicaine", "française"],
"menu": [
{ "desc": "Jambon Ibérique bellota bellota", "price": 13.0 },
{ "desc": "Fromages", "price": 8.5 }
]
}
Document
Requêtes expressives
db.restaurants.find({
"location": {
"$geoWithin": {
"$centerSphere": [
[2.337573, 48.8835],
0.0001569
]
}
},
"cuisine": "japonaise"
});
Requête de
géolocalisation
GPS de
Metro Pigalle
1 km en radians
"cuisine" peut
être un tableau
Index riches
{
"name": "Puce",
"telephone": "0953482975" ,
"site": "http://ilovepuce.com/",
"location": {
"type": "Point",
"coordinates": [2.33761, 48.8834]
},
"cuisine": ["japonaise", "mexicaine", "française"],
"menu": [
{ "desc": "Jambon Ibérique bellota bellota", "price": 13.0 },
{ "desc": "Fromages", "price": 8.5 }
]
}
db.restaurants.createIndex({
"location": "2dsphere",
"cuisine": 1
}
Demo
Données de test avec mgeneratejs
Framework d'agrégation
db.restaurants.aggregate([
{"$match": {"code_postal": "75009"}},
{"$unwind": "$cuisine" },
{"$group": { _id: "$cuisine", total: { "$sum": 1 }}},
{"$sort": { total: -1 }},
{"$limit": 10}
]);
Trouver les cuisines les plus populaire dans le 9eme
Afficher les 10 cuisines les plus populaires
Construisons une application!
Le stack MEAN
Driver MongoDB
et / ou Mongoose
Driver ou ODM?
Driver officiel
Support des dernières
fonctionnalités
Pas un ODM
3ème partie
Peut ne pas supporter les
dernières fonctionnalités
ODM
De facto avec MEAN
App - Questions & applaudissements👏
Le chemin vers Serverless:
DBaaS
MongoDB Atlas: DBaaS dans le Cloud
Libre service, élastique
et automatisé
Sécurisé par défaut
Monitoring et métriques
complètes
Globale et haute
disponibilité
Sauvegardes continues et
interrogeables.
Migrations
Organisations, équipes
et projets
Mise à jour pour se connecter à Atlas
1. Sécurité
● RBAC (utilisateur et autorisations)
● Liste blanche d'IP
2. Mettre à jour la chaîne de connexion
- SRV e.g.
mongodb+srv://nic:<PASSWORD>@tse-nic-vy6re.mong
odb.net/test?retryWrites=true
3. Migrate data
● mongoimport
● Atlas Live Import
Atlas
Wizard
On a appris quoi?
Basics
De plus? Serverless Architectures Webinar:
https://www.mongodb.com/presentations/webinar-serverless-architectures-with-aws-lamb
da-and-mongodb-atlas
Atlas Compass
Thank You!
Merci! Tack!
Cours M001 et M220
Questions?

Contenu connexe

Tendances

Cours Big Data Chap1
Cours Big Data Chap1Cours Big Data Chap1
Cours Big Data Chap1
Amal Abid
 
Introduction à Neo4j - La base de données de graphes - 2016
Introduction à Neo4j - La base de données de graphes - 2016Introduction à Neo4j - La base de données de graphes - 2016
Introduction à Neo4j - La base de données de graphes - 2016
Cédric Fauvet
 
Mongo DB
Mongo DBMongo DB
Base de données graphe et Neo4j
Base de données graphe et Neo4jBase de données graphe et Neo4j
Base de données graphe et Neo4j
Boris Guarisma
 
BigData_TP5 : Neo4J
BigData_TP5 : Neo4JBigData_TP5 : Neo4J
BigData_TP5 : Neo4J
Lilia Sfaxi
 
Mongo DB Presentation
Mongo DB PresentationMongo DB Presentation
Mongo DB Presentation
Jaya Naresh Kovela
 
Spark (v1.3) - Présentation (Français)
Spark (v1.3) - Présentation (Français)Spark (v1.3) - Présentation (Français)
Spark (v1.3) - Présentation (Français)
Alexis Seigneurin
 
BigData_Chp2: Hadoop & Map-Reduce
BigData_Chp2: Hadoop & Map-ReduceBigData_Chp2: Hadoop & Map-Reduce
BigData_Chp2: Hadoop & Map-Reduce
Lilia Sfaxi
 
Cours Big Data Chap5
Cours Big Data Chap5Cours Big Data Chap5
Cours Big Data Chap5
Amal Abid
 
Une Introduction à Hadoop
Une Introduction à HadoopUne Introduction à Hadoop
Une Introduction à Hadoop
Modern Data Stack France
 
Introduction aux bases de données NoSQL
Introduction aux bases de données NoSQLIntroduction aux bases de données NoSQL
Introduction aux bases de données NoSQL
Antoine Augusti
 
BigData_TP3 : Spark
BigData_TP3 : SparkBigData_TP3 : Spark
BigData_TP3 : Spark
Lilia Sfaxi
 
Apache sqoop with an use case
Apache sqoop with an use caseApache sqoop with an use case
Apache sqoop with an use case
Davin Abraham
 
Database/ Bases de données
Database/ Bases de donnéesDatabase/ Bases de données
Database/ Bases de données
zied kallel
 
Cours Big Data Chap4 - Spark
Cours Big Data Chap4 - SparkCours Big Data Chap4 - Spark
Cours Big Data Chap4 - Spark
Amal Abid
 
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
 
Thinking Big - Big data: principes et architecture
Thinking Big - Big data: principes et architecture Thinking Big - Big data: principes et architecture
Thinking Big - Big data: principes et architecture
Lilia Sfaxi
 
Bases de Données non relationnelles, NoSQL (Introduction) 1er cours
Bases de Données non relationnelles, NoSQL (Introduction) 1er coursBases de Données non relationnelles, NoSQL (Introduction) 1er cours
Bases de Données non relationnelles, NoSQL (Introduction) 1er cours
Hatim CHAHDI
 
Introduction to mongodb
Introduction to mongodbIntroduction to mongodb
Introduction to mongodb
neela madheswari
 
Mise en oeuvre des framework de machines et deep learning v1
Mise en oeuvre des framework de machines et deep learning v1 Mise en oeuvre des framework de machines et deep learning v1
Mise en oeuvre des framework de machines et deep learning v1
ENSET, Université Hassan II Casablanca
 

Tendances (20)

Cours Big Data Chap1
Cours Big Data Chap1Cours Big Data Chap1
Cours Big Data Chap1
 
Introduction à Neo4j - La base de données de graphes - 2016
Introduction à Neo4j - La base de données de graphes - 2016Introduction à Neo4j - La base de données de graphes - 2016
Introduction à Neo4j - La base de données de graphes - 2016
 
Mongo DB
Mongo DBMongo DB
Mongo DB
 
Base de données graphe et Neo4j
Base de données graphe et Neo4jBase de données graphe et Neo4j
Base de données graphe et Neo4j
 
BigData_TP5 : Neo4J
BigData_TP5 : Neo4JBigData_TP5 : Neo4J
BigData_TP5 : Neo4J
 
Mongo DB Presentation
Mongo DB PresentationMongo DB Presentation
Mongo DB Presentation
 
Spark (v1.3) - Présentation (Français)
Spark (v1.3) - Présentation (Français)Spark (v1.3) - Présentation (Français)
Spark (v1.3) - Présentation (Français)
 
BigData_Chp2: Hadoop & Map-Reduce
BigData_Chp2: Hadoop & Map-ReduceBigData_Chp2: Hadoop & Map-Reduce
BigData_Chp2: Hadoop & Map-Reduce
 
Cours Big Data Chap5
Cours Big Data Chap5Cours Big Data Chap5
Cours Big Data Chap5
 
Une Introduction à Hadoop
Une Introduction à HadoopUne Introduction à Hadoop
Une Introduction à Hadoop
 
Introduction aux bases de données NoSQL
Introduction aux bases de données NoSQLIntroduction aux bases de données NoSQL
Introduction aux bases de données NoSQL
 
BigData_TP3 : Spark
BigData_TP3 : SparkBigData_TP3 : Spark
BigData_TP3 : Spark
 
Apache sqoop with an use case
Apache sqoop with an use caseApache sqoop with an use case
Apache sqoop with an use case
 
Database/ Bases de données
Database/ Bases de donnéesDatabase/ Bases de données
Database/ Bases de données
 
Cours Big Data Chap4 - Spark
Cours Big Data Chap4 - SparkCours Big Data Chap4 - Spark
Cours Big Data Chap4 - Spark
 
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…
 
Thinking Big - Big data: principes et architecture
Thinking Big - Big data: principes et architecture Thinking Big - Big data: principes et architecture
Thinking Big - Big data: principes et architecture
 
Bases de Données non relationnelles, NoSQL (Introduction) 1er cours
Bases de Données non relationnelles, NoSQL (Introduction) 1er coursBases de Données non relationnelles, NoSQL (Introduction) 1er cours
Bases de Données non relationnelles, NoSQL (Introduction) 1er cours
 
Introduction to mongodb
Introduction to mongodbIntroduction to mongodb
Introduction to mongodb
 
Mise en oeuvre des framework de machines et deep learning v1
Mise en oeuvre des framework de machines et deep learning v1 Mise en oeuvre des framework de machines et deep learning v1
Mise en oeuvre des framework de machines et deep learning v1
 

Similaire à Construisez votre première application MongoDB

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
 
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
Pierre-Alban DEWITTE
 
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
Bruno Bonnin
 
Hands on lab Elasticsearch
Hands on lab ElasticsearchHands on lab Elasticsearch
Hands on lab Elasticsearch
David Pilato
 
Elasticsearch - Esme sudria
Elasticsearch - Esme sudriaElasticsearch - Esme sudria
Elasticsearch - Esme sudria
David Pilato
 
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
Silicon Comté
 
Paris data geek - Elasticsearch
Paris data geek - ElasticsearchParis data geek - Elasticsearch
Paris data geek - Elasticsearch
David Pilato
 
Lausanne JUG - Elasticsearch
Lausanne JUG - ElasticsearchLausanne JUG - Elasticsearch
Lausanne JUG - Elasticsearch
David Pilato
 
Créer des applications Java avec MongoDB
Créer des applications Java avec MongoDBCréer des applications Java avec MongoDB
Créer des applications Java avec MongoDB
MongoDB
 
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
Sébastien Prunier
 
Webinaire 4 de la série Retour aux fondamentaux : Indexation avancée, index d...
Webinaire 4 de la série Retour aux fondamentaux : Indexation avancée, index d...Webinaire 4 de la série Retour aux fondamentaux : Indexation avancée, index d...
Webinaire 4 de la série Retour aux fondamentaux : Indexation avancée, index d...
MongoDB
 
Elasticsearch - Montpellier JUG
Elasticsearch - Montpellier JUGElasticsearch - Montpellier JUG
Elasticsearch - Montpellier JUG
David Pilato
 
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
 
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
 
Spark-adabra, Comment Construire un DATALAKE ! (Devoxx 2017)
Spark-adabra, Comment Construire un DATALAKE ! (Devoxx 2017) Spark-adabra, Comment Construire un DATALAKE ! (Devoxx 2017)
Spark-adabra, Comment Construire un DATALAKE ! (Devoxx 2017)
univalence
 
Lyon JUG - Elasticsearch
Lyon JUG - ElasticsearchLyon JUG - Elasticsearch
Lyon JUG - Elasticsearch
David Pilato
 
Elasticsearch - OSDC France 2012
Elasticsearch - OSDC France 2012Elasticsearch - OSDC France 2012
Elasticsearch - OSDC France 2012
David Pilato
 
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
Tugdual Grall
 
SSL 2011 : Présentation de 2 bases noSQL
SSL 2011 : Présentation de 2 bases noSQLSSL 2011 : Présentation de 2 bases noSQL
SSL 2011 : Présentation de 2 bases noSQL
Hervé Leclerc
 

Similaire à Construisez votre première application MongoDB (20)

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
 
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
 
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
 
Hands on lab Elasticsearch
Hands on lab ElasticsearchHands on lab Elasticsearch
Hands on lab Elasticsearch
 
Elasticsearch - Esme sudria
Elasticsearch - Esme sudriaElasticsearch - Esme sudria
Elasticsearch - Esme sudria
 
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
 
Paris data geek - Elasticsearch
Paris data geek - ElasticsearchParis data geek - Elasticsearch
Paris data geek - Elasticsearch
 
Lausanne JUG - Elasticsearch
Lausanne JUG - ElasticsearchLausanne JUG - Elasticsearch
Lausanne JUG - Elasticsearch
 
Créer des applications Java avec MongoDB
Créer des applications Java avec MongoDBCréer des applications Java avec MongoDB
Créer des applications Java avec MongoDB
 
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
 
Webinaire 4 de la série Retour aux fondamentaux : Indexation avancée, index d...
Webinaire 4 de la série Retour aux fondamentaux : Indexation avancée, index d...Webinaire 4 de la série Retour aux fondamentaux : Indexation avancée, index d...
Webinaire 4 de la série Retour aux fondamentaux : Indexation avancée, index d...
 
Elasticsearch - Montpellier JUG
Elasticsearch - Montpellier JUGElasticsearch - Montpellier JUG
Elasticsearch - Montpellier JUG
 
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
 
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.
 
Spark-adabra, Comment Construire un DATALAKE ! (Devoxx 2017)
Spark-adabra, Comment Construire un DATALAKE ! (Devoxx 2017) Spark-adabra, Comment Construire un DATALAKE ! (Devoxx 2017)
Spark-adabra, Comment Construire un DATALAKE ! (Devoxx 2017)
 
Lyon JUG - Elasticsearch
Lyon JUG - ElasticsearchLyon JUG - Elasticsearch
Lyon JUG - Elasticsearch
 
Elasticsearch - OSDC France 2012
Elasticsearch - OSDC France 2012Elasticsearch - OSDC France 2012
Elasticsearch - OSDC France 2012
 
Hello mongo
Hello mongoHello mongo
Hello mongo
 
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
 
SSL 2011 : Présentation de 2 bases noSQL
SSL 2011 : Présentation de 2 bases noSQLSSL 2011 : Présentation de 2 bases noSQL
SSL 2011 : Présentation de 2 bases noSQL
 

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 Atlas
MongoDB
 
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 MongoDB
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
 
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
 
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
 
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.2
MongoDB
 
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 Mindset
MongoDB
 
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
 
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 Dive
MongoDB
 
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
 
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...
 

Construisez votre première application MongoDB

  • 1.
  • 2. Votre première app MongoDB Nic Cottrell, Ingénieur Services Techniques, MongoDB 4 décembre 2018 Paris, France
  • 3. Les bases de MongoDB: ● Collections, ● Documents JSON, ● CRUD, ● Indexes, ● Aggregation Framework Visualiser les données MongoDB Application simple sur le stack MEAN Agenda
  • 4. Nicholas Cottrell Technical Services Engineer nicholas.cottrell@mongodb.com Normandie, France stackoverflow.com/users/543315/nic-cottrell github.com/niccottrell/mongodb-paris-2018
  • 6. Dynamique et Naturel Rigide et Normalisé { "_id": "Emp123", "nom": "Jean Leblanc", "titre": "Dev superstar", "telephones": [ "0123456789", "063456789"] } Id (VARCHAR) Nom (VARCHAR) Emp123 Jean Leblanc Id (VARCHAR) PhoneId (Int) Emp123 456 Emp123 567 PhoneId Phone (VARCHAR) 456 0123456789 567 063456789 vs
  • 7. { "_id": 123, "nom": "Jean Leblanc", "hps": NumberDecimal("37.5"), "telephones": [ "0123456789", "063456789"], "commence": ISODate("2016-10-05"), "bureau": { "ville": "Paris", "lieu": { type: "Point", coordinates: [2.3333, 48.86] } }, "equipe": [ { "id": 189, "nom": "Camille Martin"}, { "id": 256, "nom": "Maxime Lefevre" }, ... ] } Les documents - structures de données riches Champs Nombre entier Chaîne de caractères Géo-localisation Nombre à virgule flottante Tableau de sous-documents Date Décimal
  • 8. { "_id": 123, "nom": "Jean Leblanc", "hps": NumberDecimal("37.5"), "telephones": [ "0123456789", "063456789"], "commence": ISODate("2016-10-05"), "bureau": { "ville": "Paris", "lieu": { type: "Point", coordinates: [2.3333, 48.86] } }, "equipe": [ { "id": 189, "nom": "Camille Martin"}, { "id": 256, "nom": "Maxime Lefevre" }, ... ] ... Les documents - structures de données riches Champs Nombre entier Chaîne de caractères Géo-localisation Nombre à virgule flottante Tableau de sous-documents Interroger et indexer des données à n'importe quel niveau Date Décimal
  • 9. { "_id": 284, "nom": "Melanie Mercier" "titre": "Developpeur senior" "commence": ISODate("2017-06-11") "competences": ["java", "nodejs", "spring data"], "device": "MacBook Pro 15", ... } Les documents sont flexibles { "_id": 123, "nom": "Jean Leblanc" "titre": "Chef superstar" "telephones": [ "0123456789", "063456789"] "commence": ISODate("2016-10-05") … } Schéma polymorphes - aligné avec les principes de la POO
  • 10. { "_id": 284, "nom": "Melanie Mercier" "titre": "Developpeur senior" "commence": ISODate("2017-06-11") "competences": ["java", "nodejs", "spring data"], "device": "MacBook Pro 15", ... } Les documents sont flexibles { "_id": 123, "nom": "Jean Leblanc" "titre": "Chef superstar" "telephones": [ "0123456789", "063456789"] "commence": ISODate("2016-10-05") … } Schéma polymorphes - aligné avec les principes de la POO db.staff.find({titre: /^Developpeur/}, {nom: 1, competences: 1})
  • 11. SQL vs NoSQL BdD relationnelle MongoDB Gouvernance des données Validation du document et Schéma JSON Triggers Change Streams (3.6+) Jointures $lookup (externe gauche) Index et vues ✔ et ✔ GROUP BY Framework d'agrégation
  • 12. SQL vs NoSQL BdD relationnelle MongoDB Gouvernance des données Validation du document et Schéma JSON Triggers Change Streams (3.6+) Jointures $lookup (externe gauche) Index et vues ✔ et ✔ GROUP BY Framework d'agrégation NoSQL MongoDB Haute disponibilité Replica Sets Scalabilité Sharding
  • 13. Standalone / Local dev Standalone
  • 16. MongoDB - le meilleur des deux mondes Fondations du SGBDR Avantages de NoSQL Langage d'interrogation expressif et index secondaires Intégrité des données Gestion d'entreprise et intégrations La flexibilité Évolutivité et performance Déploiement global et toujours disponible #1 BdD à la croissance la plus rapide + de 30 millions téléchargements uniques 4e BdD la plus populaire + de 5.000 clients payants + de 50.000 membres du groupe d'utilisateurs MongoDB 75% clients du Global 500 + de 500.000 étudiants en ligne + de 3.000 clients Atlas
  • 17. Développement local npm install mongodb --save mongod --dbpath /data Télécharger Compass
  • 21. Trouvez des restaurants à moins de 1 km du métro Pigalle qui servent la cuisine japonaise
  • 22. { "name": "Puce", "telephone": "0953482975", "site": "http://ilovepuce.com/", "code_postal": "75009", "location": { "type": "Point", "coordinates": [2.33761, 48.8834] }, "cuisine": ["japonaise", "mexicaine", "française"], "menu": [ { "desc": "Jambon Ibérique bellota bellota", "price": 13.0 }, { "desc": "Fromages", "price": 8.5 } ] } Document
  • 23. Requêtes expressives db.restaurants.find({ "location": { "$geoWithin": { "$centerSphere": [ [2.337573, 48.8835], 0.0001569 ] } }, "cuisine": "japonaise" }); Requête de géolocalisation GPS de Metro Pigalle 1 km en radians "cuisine" peut être un tableau
  • 24. Index riches { "name": "Puce", "telephone": "0953482975" , "site": "http://ilovepuce.com/", "location": { "type": "Point", "coordinates": [2.33761, 48.8834] }, "cuisine": ["japonaise", "mexicaine", "française"], "menu": [ { "desc": "Jambon Ibérique bellota bellota", "price": 13.0 }, { "desc": "Fromages", "price": 8.5 } ] } db.restaurants.createIndex({ "location": "2dsphere", "cuisine": 1 }
  • 25. Demo Données de test avec mgeneratejs
  • 26. Framework d'agrégation db.restaurants.aggregate([ {"$match": {"code_postal": "75009"}}, {"$unwind": "$cuisine" }, {"$group": { _id: "$cuisine", total: { "$sum": 1 }}}, {"$sort": { total: -1 }}, {"$limit": 10} ]); Trouver les cuisines les plus populaire dans le 9eme Afficher les 10 cuisines les plus populaires
  • 28. Le stack MEAN Driver MongoDB et / ou Mongoose
  • 29. Driver ou ODM? Driver officiel Support des dernières fonctionnalités Pas un ODM 3ème partie Peut ne pas supporter les dernières fonctionnalités ODM De facto avec MEAN
  • 30. App - Questions & applaudissements👏
  • 31. Le chemin vers Serverless: DBaaS
  • 32. MongoDB Atlas: DBaaS dans le Cloud Libre service, élastique et automatisé Sécurisé par défaut Monitoring et métriques complètes Globale et haute disponibilité Sauvegardes continues et interrogeables. Migrations Organisations, équipes et projets
  • 33. Mise à jour pour se connecter à Atlas 1. Sécurité ● RBAC (utilisateur et autorisations) ● Liste blanche d'IP 2. Mettre à jour la chaîne de connexion - SRV e.g. mongodb+srv://nic:<PASSWORD>@tse-nic-vy6re.mong odb.net/test?retryWrites=true 3. Migrate data ● mongoimport ● Atlas Live Import
  • 35. On a appris quoi? Basics De plus? Serverless Architectures Webinar: https://www.mongodb.com/presentations/webinar-serverless-architectures-with-aws-lamb da-and-mongodb-atlas Atlas Compass