Chapter 1: Lab for $match stage

I found this weird. I am running the aggregation query according to the requirements mentioned. The count that I am finding and the correct answer is different. Am I doing anything wrong? It’s just me getting different counts or that’s the same for everyone?

Also, I tried executing the same from command line (Using Mongoclient) and found the same incorrect answer that I am talking about in the post.

Welcome @viraj_thakrar,

I’m getting the same number of documents as you which is different from the answer. The Curriculum Support Engineer for this course (@Sonali_Mamgain) will be able to advise when she gets to your thread.

In the meantime, it’s against forum guidelines to post potential answers to labs or exams. Suggest you delete the screenshot and remove the number of documents from your post.

@007_jb, I would never post something that’s against the forum guidelines. I had attached the screenshot because it was not the correct answer. I have removed it as you have suggested. Never Mind…!!

:slightly_smiling_face: :+1:

Hi @viraj_thakrar,

I checked your edited post and figured out you are getting 23 documents returned.
This is the correct number of documents. You can also check, it is mentioned in the lab as a hint:

As a hint, your aggregation should return 23 documents. You can verify this by typing db.movies.aggregate(pipeline).itcount()

You should proceed further with the lab and you will get the correct answer after validation.

Please let me know, if I am misunderstanding anything or if you have any questions. We can further debug the issue in discourse inbox.

Thanks,
Sonali

Hi @viraj_thakrar,

Please follow all the steps mentioned in the lab to get the correct answer:

  1. You have already created the pipeline, and the aggregation returns 23 documents.
  2. Now you need to load the validateLab1.js into mongo shell, using below command:

load(‘validateLab1.js’)

  1. Then you have to run validateLab1 validation method:

validateLab1(pipeline)

Then you will get the answer for this lab.

Please let me know, if you have any questions.

Thanks,
Sonali

Yes. I got it. Thanks a lot for helping out.