Chapter 3: Lecture: Array Operators: $size.Quiz

Hi.
I can`t resolve the Problem:

Connect to our class Atlas cluster from the mongo shell or Compass and view the 100YWeatherSmall.data collection. How many documents in this collection contain exactly two elements in the sections array field?
I dont understand what command I need to use to count exactly two elements from the collection. I understand it dosent metter if the elements are different and it dosen`t metter in what order they come. What I need to find is exactly two, but I dont understand how $size help me to do that?

The question in the quiz was: How many documents in this collection contain exactly two elements in the sections array field? After i run this command: db.data.find({sections: {$size: 2}}).pretty() finaly I got the answer. But I am still don`t understand. Because from the lecture I understand that my command should give me all resaults with GF1. I understand now that I got 2 elements, but it wasnt clear.

Does it say in the quiz that the result of the array will contain “GF1”?

No, he dosen`t. Thank You.

Good :+1: I was asking because I didn’t take this course so I wasn’t sure what was stated in the quiz.

Hi @Semion_79117,

I would highly recommend you to go through our documentation on $size and it would clear some of your doubts.

After that please watch the video one more time and then let me know if you still have any questions.

Thanks,
Shubham Ranjan
Curriculum Services Engineer