Lab: Using Cursor-like Stages [Incorrect answer]

Hi,

It seems like I did added all the requirements to the pipeline and I don’t understand where I’m wrong, My query is,
db.movies.aggregate([{$match: {$and: [{‘countries’: ‘USA’}, {‘tomatoes.viewer.rating’: {$gte: 3}}, {‘cast’: {$in: [“Sandra Bullock”, “Tom Hanks”, “Julia Roberts”, “Kevin Spacey”, “George Clooney”]}}]}}, {$addFields: {num_favs: {’$size’: {’$setIntersection’: [’$cast’, [“Sandra Bullock”,“Tom Hanks”,“Julia Roberts”, “Kevin Spacey”, “George Clooney”]]}}}}, {$sort: {‘num_favs’:-1, ‘tomatoes.viewer.rating’: -1, ‘title’: -1}}, {$skip:24}, {$limit: 1}, {$project: {title: 1}} ])

I see nothing obviously wrong with your pipeline.

I suspect that you might be using the wrong database or collection. Perhaps you are using the sample data set loaded for another course. For M121 you are supposed to the aggregations database from the M121 class cluster.

1 Like

It’s working, thanks.

1 Like

Please mark my post as the solution.

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.