Chapter 3 : user reports

Hi,
I just use three stages $group, $count, and $limit on comments collections. what should i do next ? is it correct ? if it’s correct what will be the next stage.please give a hint.

Screenshot%20from%202019-06-27%2013-10-33

Hi @Hamza_23934,

The pipeline seems correct. Now you just need to implement this in the code and run the unit test:

 npm test -t user-report

Kanika

Hi,
but the return value from the pipline is undefined, why is that? when i run the test. here is the screenshot shot of console.

Hey @Hamza_23934
From the error response you displayed, I believe the syntax of your pipeline is incorrect. The pipeline is wrapped in 2 sets of square brackets;

It seems when you copied the output from mongo-compass it is the entire pipeline with square brackets. Did you paste this inside the square brackets of const pipeline = []?

Try looking over the syntax and remove and extra []

2 Likes

Hi @natac13,
Thank you sooo much, it’s a big relieve i was stuck on it from yesterday.
it works for me :grin: , i never know that this was the mistake . Thanks for identifying it
Regards,
Hamza Alam

1 Like

Screenshot%20from%202019-06-28%2015-38-11

1 Like