Get startedGet started for free

Composing filters

It is often useful to incrementally build up a filter document in order to see the effect of adding constraints one at a time. In this exercise, we will count the number of laureate documents matching some criteria, and we will gradually add criteria.

This exercise is part of the course

Introduction to MongoDB in Python

View Course

Hands-on interactive exercise

Have a go at this exercise by completing this sample code.

# Create a filter for laureates who died in the USA
criteria = {____: ____}

# Save the count of these laureates
count = db.laureates.count_documents(____)
print(count)
Edit and Run Code