ComeçarComece de graça

Embedding aggregation expressions

The $expr operator allows embedding of aggregation expressions in a normal query (or in a $match stage). Which of the following expressions counts the number of laureate documents with string-valued bornCountries when passed to db.laureates.count_documents?

You can assume (and check!) that the following is true:

assert all(isinstance(v, str) for v in db.laureates.distinct("bornCountry"))

Este exercício faz parte do curso

Introduction to MongoDB in Python

Ver curso

Exercício interativo prático

Transforme a teoria em ação com um de nossos exercícios interativos

Começar o exercício