Atlas 101 Eworkshop Spanish
Atlas 101 Eworkshop Spanish
Atlas 101 Eworkshop Spanish
Taller :
Fundamentos de Atlas
Avisos
Avisos
Cierre
Gustavo Chavez
Arquitecto de Soluciones
@GCH4V3Z
Alejandro Mancilla
Arquitecto de Soluciones
@alxmancilla
Agenda
Introducciones e Inicio
Cierre
¿Por qué MongoDB ?
MongoDB
PostgreSQL
Elasticsearch
Intuitiva y flexible
Redis Modelo Documental
Firebase
2,000,000+
MongoDB Atlas
Consistently Voted Most Wanted Database
Clusters
1,000+
Technology and
Services Partners DB-Engines
Rankings
29,000+
Customers Across All
Industries
{
"_id" : ObjectId("5ad88534e3632e1a35a58d00"),
"name" : {
"first" : "John",
"last" : "Doe" },
"address" : [
{ "location" : "work",
"address" : {
"street" : "16 Hatfields",
"city" : "London",
"postal_code" : "SE1 8DJ"},
"geo" : { "type" : "Point", "coord" : [
51.5065752,-0.109081]}},
+ {...}
],
"dob" : ISODate("1977-04-01T05:00:00Z"),
"retirement_fund" : NumberDecimal("1292815.75")
}
{ {
"_id" : ObjectId("5ad88534e3632e1a35a58d00"), "_id" : ObjectId("5ad88534e3632e1a35a58d00"),
"name" : { "name" : {
"first" : "John", "first" : "John",
"last" : "Doe" }, "last" : "Doe" },
"address" : [ "address" : [
{ "location" : "work", { "location" : "work",
"address" : { "address" : {
"street" : "16 Hatfields", "street" : "16 Hatfields",
"city" : "London", "city" : "London",
"postal_code" : "SE1 8DJ"}, "postal_code" : "SE1 8DJ"},
"geo" : { "type" : "Point", "coord" : [ "geo" : { "type" : "Point", "coord" : [
51.5065752,-0.109081]}}, 51.5065752,-0.109081]}},
+ {...} + {...}
], ],
"dob" : ISODate("1977-04-01T05:00:00Z"), "phone" : [
"retirement_fund" : NumberDecimal("1292815.75") { "location" : "work",
"number" : "+44-1234567890"},
} + {...}
],
"dob" : ISODate("1977-04-01T05:00:00Z"),
"retirement_fund" : NumberDecimal("1292815.75")
}
Rust R
MongoDB Query API: Rico en capacidades/Expresivo
Geospatial
• Find the best offer for the customer at geo
coordinates of 42nd St. and 6th Ave { customer_id : 1,
first_name : "Mark",
Text Search
• Find all tweets that mention the firm within the
last_name : "Smith",
last 2 days
city : "San Francisco",
Aggregation
• Count and sort number of customers by city, phones: [ {
compute min, max, and average spend
number : "1-212-777-1212",
• Add an additional phone number to Mark type : "work"
Native Binary Smith’s record without rewriting the document },
JSON Support • Update just 2 phone numbers out of 10
• Sort on the modified date {
number : "1-212-777-1213",
• Query for all San Francisco residences, lookup
JOIN type : "cell"
($lookup) their transactions, and sum the amount by
person }]
……...
Graph Queries
($graphLookup
• Query for all people within 3 degrees of
) separation from Mark
Completamente Indexable
Índices con capacidades extendidas - Optimizada para documentos - Mejoras más allá de la experiencia
RDBMS
• Unique Indexes
• Compound Index
– Ensures value is not duplicated
– Index against multiple keys in the document
• Partial Indexes
• MultiKey Index – Expression based indexes, allowing indexes on subsets of
– Index into arrays data
• GeoSpatial Indexes
– 2d & 2dSphere indexes for spatial geometries
• Clustered Indexes
– For time series collections, pre-sorted by timestamp for
low latency queries
Transacciones “ACID” Multi-Documento
ACID guarantees
• Snapshot isolation, all or nothing execution
START TRANSACTION; session.startTransaction();
INSERT INTO orders (...) VALUES (...); db.orders.insert ({...})
UPDATE stock SET quantity=... WHERE ...; db.stock.update ({... } }, { $set: { quantity: ...} }})
COMMIT; session.commitTransaction();
MongoDB Replica Sets
2 a 50 copias
Application
Secondary Replication
Secondary
Arquitectura : “Sharding”
Application
Driver
Escalamiento Horizontal
- Sharding
Alcance Amplio: Privado, Hibrido, Publico
Self-managed
Database as a Service
Laptop Own Datacenter Private cloud in the cloud
Password:
AtlasW0rkshop!
Confirma tu invitación
Haz click en el botón y expande el
menú para poder ver tus “invitaciones”, y
aceptar la invitación
Acepta la invitacion
1)
2)
Ahora revisa tus clusters!
Debes de tener un "demo" cluster
Bienvenido al panel de control de Atlas
Agenda
Introducciones e Inicio
Cierre
Configuracion
Ejercicio 1
Configuracion MongoDB Atlas:
Ejercicio 2
MongoDB Atlas CRUD:
Download compass
mongodb.com/try/download/compass
Conecte compass a Atlas
Vamos a ver los datos ...
Seleccionemos una colección ...
Ejercicio 1
{title:"Ghostbusters"}
Ejercicio 3
db.movies.find({year:1987})
CRUD: Concurso
db.movies.find({genres: "Comedy"})
CRUD: Concurso
db.movies.find({genres:["Comedy"]})
CRUD: Concurso
db.movies.find({genres:{$in:["Comedy", "Drama"]}})
CRUD: Concurso
Ejercicio 3
- Índices y planes de ejecución
Al finalizar este ejercicio usted será capaz de …
En Compass
Ejercicio
nuevo !
Genial!
Este índice utiliza la regla de ESR :
Equality (cast), Sort (title), Range (year)
Tomemos 5 min de
descanso :)
Ejercicio
Ejercicio 4
- Framework de agregación
Al final de este ejercicio usted será capaz de ...
analitica ] )
{ status: "A",
cust_id: "A123", }
amount: 300,
status: "D",
}
Orders
Capacidades de Agregacion
Un “Framework” lleno de capacidades compuestas y expresivas
Vamos a Darle!
Generemos algunas agregaciones
[{$match: {
"tomatoes.viewer.rating":{$gt:3}
}}, {$group: {
_id: "$countries",
"movie_count": {
$sum: 1
},
"award_count" : {
$sum: "$awards.wins"
},
"nomination_count" : {
$sum: "$awards.nominations"
},
"max_tomatoes_rating": {
$max: "$tomatoes.viewer.rating"
}
}}, {$sort: {
"movie_count": -1
}}]
/**
* Match movies built between the 1990 to 2000
*/
{
"year":{$gte:1990,$lt:2000},
"tomatoes.viewer.rating":{$gt:4}
}
Aggregation workshop : Concurso
Aggregation Question
Aggregation Question
Aggregation Question
Aggregation Question
{$unwind: {path: "$countries"}} How can you create an individual document for each country the
movie was in?
Aggregation workshop : Concurso
Aggregation Question
{$unwind: {path: "$countries"}} How can you create an individual document for each country the
movie was in?
Aggregation Question
{$unwind: {path: "$countries"}} How can you create an individual document for each country the
movie was in?
{$out: "trivial"} How can you output the results into a new collection?
Aggregation workshop : Concurso
Aggregation Question
{$project: {
_id:0,
title:1,
yearsOld: {
$subtract:[2021,"$year"]}
}
}
Aggregation workshop : Concurso
Aggregation Question
{$project: { How can you display just the title and the age of the movie in years?
_id:0,
title:1,
yearsOld: {
$subtract:[2021,"$year"]}
}
}
Ejercicio
Ejercicio 5
- Índices de búsqueda textual
- Agrega Lucene Full Text Search como un
servicio completamente administrado a su
clúster Atlas
- Power of Lucene 8, sin aprovisionamiento y
ejecución de una plataforma de búsqueda
separada
- Integrado con MongoDB Query Language,
por lo que no hay API separadas para
aprender
- Indexación dinámica y estática que admite
difusa y comodín búsqueda, booleano y
compuestas consultas, analizadores de
Atlas Search -
idiomas, puntuación y fragmentos
Configurados a través de Atlas Data Explorer o
API
Exercise
Ejercicio 6
- Crear un dashboard en "Atlas Charts"
MongoDB Charts: Cree, Visualize, Comparta
Active Charts
Active Charts (1)
Add the Data Collection as a Data Source:
Cierre / Preguntas ?
● La manera más rápida de empezar con MongoDB:
https://www.mongodb.com/cloud/atlas
Cursos Caminos de
en línea aprendizaje
Paneles de
Certificaciones negocio
Developer Hub
Preguntas ?
Mil Gracias !
Gustavo Chávez | Arquitecto de soluciones | MongoDB | @GCH4V3Z