9. Topic
Exchange
Route
by
Key
with
Key
Globbing
Bebida.Vino
Bebida.Vino
Bebida.Vino
Bebida.#
Comida.*
#.Vino
10. Nanite
• Nanite
is
a
new
way
of
thinking
about
building
cloud
ready
web
applicaAons.
Having
a
scalable
message
queueing
back-‐end
with
all
the
discovery
and
dynamic
load
based
dispatch
that
Nanite
has
is
a
very
scalable
way
to
construct
web
applicaAon
back-‐ends.
11.
12. MongoDB
es
…
• DB
Orientado
a
documentos
(schemaless)
• “Facil”
escalar
horizontal
(shard)
• Para
mantener
estructuras
complejas
(jerarquicas)
• Para
estadísAcas
“simples”
• Para
mantener
archivos
(GridFS)
13. MongoDB
NO
es
…
• Para
transaciones
• Para
OLAP
• RDBMS
(AcAveRecord?)
14. Select
SELECT
first_name,
last_name
FROM
authors
WHERE
zipcode
=
1234
ORDER
BY
last_name
DESC
LIMIT
2,
1;
>
db.authors.find({"zipcode"
:
1234},
{"first_name"
:
1,
"last_name"
:
1
}).sort({"last_name"
:
-‐1
})
.skip(2).limit(1);
15. Select
SELECT
*
FROM
authors
WHERE
dob
BETWEEN
‘1970-‐1-‐1’
AND
‘1990-‐1-‐1’
AND
address
IS
NULL;
>
db.authors.find({"dbo"
:
{
$gte
:
new
Date(“1970-‐1-‐1”),
$lte
:
new
Date(“1990-‐1-‐1”)},
“address”
:
{
$exists
:
false
}
}
);
17. Indexes
>
db.
tweets.ensureIndex(
{"user.Ame_zone"
:
1},
{background:true});
>
db.tweets.ensureIndex(
{"created_at"
:
1,
"user.Ame_zone"
:
1,
"tokens"
:
1},
{background:true});
background:true
no
lock
para
crear
indices
>
db.tweets.getIndexes()
18. Prós
Contras
• Schemaless
• Map-‐Reduce
MUY
lento
• Rápida
instalación
• Sharding
es
BETA
• Muchos
Drivers
• Nuevo
set
de
disponibles
commandos
19. Tips
• Pensar
BIEN
el
schema
antes
de
empezar
• Guardar
calculaAon
• Evitar
map-‐reduce
(unAl
r.
1.8)
• Indexes
TIENEN
que
entrar
en
RAM
>
db.
tweets.totalIndexSize();
1187423168
(~1.1Gb)
>
db.
tweets.storageSize();
16670199040
(~15.5
Gb)