Get startedGet started for free

Sharing in physics after World War II

What is the approximate ratio of the number of laureates who won an unshared ({"share": "1"}) prize in physics after World War II ({"year": {"$gte": "1945"}}) to the number of laureates who won a shared prize in physics after World War II?

For reference, the code below determines the number of laureates who won a shared prize in physics before 1945.

db.laureates.count_documents({
    "prizes": {"$elemMatch": {
        "category": "physics",
        "share": {"$ne": "1"},
        "year": {"$lt": "1945"}}}})

This exercise is part of the course

Introduction to MongoDB in Python

View Course

Hands-on interactive exercise

Turn theory into action with one of our interactive exercises

Start Exercise