Text and subfield search NameError: name 'db' is not defined

Hello, I’m getting stuck on something and it seems really bizarre. I have pytest -m connection and pytest -m get_movies_by_country working like a dream. And I am fairly confident I have the genres query formatted correctly:

  • query = {"genres": {"$in": filters["genres"]}})

But I get the following error from line 221, which I didn’t even edit.

  • Line 221: cursor = db.movies.find(query).sort(sort)
  • Error: NameError: name 'db' is not defined

Do I need to do anything else? Maybe passing query into something else, or changing what the function returns, or just re-downloading the entire zip file again?

Turns out deleting db = LocalProxy(get_db) is a bad idea. No idea how/why I did that. Silly issue. Solved.

Great that you solved it and I’ll close out this topic now. The best of luck with the rest of the course!

Kindest regards,
Eoin