BaşlayınÜcretsiz Başlayın

The $in operator

With the $in operator, you can find documents with fields that have one of the specified values. The $in operator works both for fields that have single values, as well as arrays, like the genre field.

The first document in the collection has been printed for you to refresh your memory on the fields in the movies collection.

Bu egzersiz

Introduction to MongoDB in Python

kursunun bir parçasıdır
Kursu Görüntüle

Egzersiz talimatları

  • Find the first movie that has a release year of 2010 or 2011 and store the result as tens.
  • Find the first movie that has a genre of "action" or "comedy" and store the result as bang.

Uygulamalı interaktif egzersiz

Bu örnek kodu tamamlayarak bu egzersizi bitirin.

# Find movie that has release_year 2010 or 2011
tens = mov.find_one(____)
print(tens)

# Find movie that has genre "action" or "comedy" 
bang = mov.find_one(____)
print(bang)
Kodu Düzenle ve Çalıştır