Chapter2 - Lab1

Hello, I am doing lab 1 and when I execute the following aggregation I get the movie with the title “L.A. Confidential” as a response that does not appear among the possible solutions. What am I doing wrong?

var pipeline = [{
$match:{
countries:“USA”,
“tomatoes.viewer.rating”:{$gte:3},
cast:{$in: favorites}
}
},{
$project:{
_id:0,
num_fav:{
$size: {
$setIntersection:[
“$cast”,
favorites
]
}
},
tomatoes:"$tomatoes.viewer.rating",
title:1
}
},{
$sort:{
num_favs:-1,
tomatoes:-1,
title:-1
}
},{
$skip:24
},{
$limit:1
}]

PS: Excuse my English, I speak Spanish.

Hello and Bienvenido @Nicolas_Cavilla ,

Double check this field: "num_favs"

2 Likes

Good catch. I completely failed to spot that.

1 Like