Skip to content

Commit

Permalink
Update 3.1-MongoDB.md
Browse files Browse the repository at this point in the history
Arreglado y comprobado aggregate para max/min
  • Loading branch information
edgartamu authored May 16, 2024
1 parent c84e297 commit 0e10a9f
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion Slides/3.1-MongoDB.md
Original file line number Diff line number Diff line change
Expand Up @@ -1020,7 +1020,8 @@ db.movies.aggregate([
}
},
{ $unwind: "$peliculas_max_votos" }, // Deshacer el array de películas
{ $match: { "peliculas_max_votos.votos_totales" : {$eq: "$max_votos" } }
{ $match: { $expr: {$eq: ["$peliculas_max_votos.votos_totales", "$$ROOT.max_votos"] } },
{ $ReplaceRoot: {newRoot: "$peliculas_max_votos"}
])

```
Expand Down

0 comments on commit 0e10a9f

Please sign in to comment.