Hi,
I’m trying to do my home work in my M121 course, my aggregation pipeline is returning the right number of document (23). when I try running the other steps I get this error:
“cyclic dependency detected”, Please can anyone help?
Hey @Okere_Godwin,
Welcome to the MongoDB Community Forums!
This syntax is likely causing the issue:
var pipeline = db.movies.aggregate(...)
Please assign the aggregation to the variable pipeline
like this:
var pipeline = [ { $match: { ... } } ]
and then load and run the validateLab1
validation method as you did before.
Also, I see you adding multiple $match
stages. You can combine them into one $match
stage like this:
var pipeline = [
{
$match: {
“imdb.rating”: { $gte: 7 },
genres: { $nin: [ “Crime”, “Horror” ] } ,
rated: { $in: [“PG”, “G” ] },
languages: { $all: [ “English”, “Japanese” ] }
}
}
]
Here are some more examples of $match for your reference.
Let us know if the problem still persists. Feel free to reach out for anything else as well.
Regards,
Satyam
Thanks Satyam,
Your reply was highly helpful, you helped me solve the problem.
This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.