1. Learn
  2. /
  3. Courses
  4. /
  5. Introduction to MongoDB in Python

Exercise

We've got options

Sometimes, we wish to find documents where a field's value matches any of a set of options. We saw that the $in query operator can be used for this purpose. For example, how many laureates were born in any of "Canada", "Mexico", or "USA"?

If we wish to accept all but one option as a value for a field, we can use the $ne (not equal) operator. For example, how many laureates died in the USA but were not born in the USA?

Instructions 1/2

undefined XP
  • 1
    • How many laureates were born in "USA", "Canada", or "Mexico"? Save a filter as criteria and your count as count.
  • 2
    • How many laureates died in the USA but were not born there? Save your filter as criteria and your count as count.