10. Opérateurs vs. SQL
SQL Terms, Functions, and Concepts MongoDB Aggregation Operators
WHERE $match
GROUP BY $group
HAVING $match
SELECT $project
ORDER BY $sort
LIMIT $limit
SUM() $sum
COUNT() $sum
join N/A
~ $unwind / arrays
30. Index
● Index utilisé pour certains opérateurs, en
début de pipeline
○ $match
○ $sort
○ $geoNear
● explain
○ db.collection.aggregate([...],
{explain: true})
31. Index
● Optimisations
{ $sort: { age : -1 } },
{ $match: { status: 'A' } }
{ $match: { status: 'A' } },
{ $sort: { age : -1 } }
“ Optimizations are subject to change between releases. “
32. Sharding
● Découpage du pipeline en deux parties
○ 1ère partie (jusqu’au premier $group ou $sort)
exécutée sur chaque shard (certains shards peuvent
être exclus grâce à un $match)
○ 2ème partie exécutée sur le shard primaire à partir
des résultats consolidés de la première partie
33. The end
Merci pour votre attention !
● Questions / Réponses
● Partage d’expérience